角图添加另一个点

问题描述 投票:0回答:1

我正在使用以下MWE:

def contour(fit, mu_des,dt_des):
    la = fit.extract(permuted=True)
    mu_pos = np.vstack((la['mu'])).T
    dt_pos = np.vstack((la['dt'])).T
    postsamples = np.vstack((mu_pos, dt_pos)).T
    fig = corner.corner(postsamples, labels=[r"$\mu$", r"$dt$"],color='g', smooth=1,
                        levels=(0.68,0.95),plot_density=0, fill_contours=1, plot_datapoints=1,
                           truths=list([mu_des,dt_des]))
    return fig

现在我也想在图中显示一个自定义点。问题有点类似于this question,但我无法理解答案。请帮助。

python plot contour mcmc
1个回答
0
投票

[好吧,我在link given below.之后得到了答案可以将功能更改为

def contour(fit):
    la = fit.extract(permuted=True)
    mu_pos = np.vstack((la['mu'])).T
    dt_pos = np.vstack((la['dt'])).T
    #print(mu_pos.shape)
    #P_pos=np.vstack((la['P'])).T
    postsamples = np.vstack((mu_pos, dt_pos)).T
    #print(postsamples.shape)
    fig = corner.corner(postsamples, labels=[r"$\mu$", r"$dt$"],color='g', smooth=1,
                        levels=(0.68,0.95),plot_density=0, fill_contours=1, plot_datapoints=1,
                           truths=list([mu_des,dt_des]))
    axes = np.array(fig.axes).reshape((2, 2)); print(axes)
    ax = axes[1, 0]; 
    ax.plot(value1, value2, "sg")
    return fig
© www.soinside.com 2019 - 2024. All rights reserved.