python修改误差棒的样式_科学网—Python里面给数据点不同颜色不对称的横纵误差棒 - 张书会的博文...

eg1:

eg2:

x1=mux1_mcmc[0]

y1=muy1_mcmc[0]

x2=mux2_mcmc[0]

y2=muy2_mcmc[0]

x1err=sigmax1_mcmc[0]

y1err=sigmay1_mcmc[0]

x2err=sigmax2_mcmc[0]

y2err=sigmay2_mcmc[0]

x=samplers[:,0]

y=samplers[:,1]

print(len(x))

print(np.min(x),np.max(x),np.min(y),np.max(y))

left, width = 0.1, 0.65

bottom, height = 0.1, 0.65

spacing = 0.005

rect_scatter = [left, bottom, width, height]

rect_histx = [left, bottom + height + spacing, width, 0.2]

rect_histy = [left + width + spacing, bottom, 0.2, height]

# start with a rectangular Figure

plt.figure(figsize=(8, 8))

ax_scatter = plt.axes(rect_scatter)

ax_scatter.tick_params(direction='in', top=True, right=True)

ax_histx = plt.axes(rect_histx)

ax_histx.tick_params(direction='in', labelbottom=False)

ax_histy = plt.axes(rect_histy)

ax_histy.tick_params(direction='in', labelleft=False)

#####################################################################

# the scatter plot:

ax_scatter.scatter(x, y)

axs0=plt.axes(rect_scatter)

axs0.plot(x1,y1,'r-')

axs0.errorbar(x1, y1, xerr=x1err,yerr=y1err,alpha=1.0,markersize=3,fmt='ro')

axs0.plot(x2,y2,'b-')

axs0.errorbar(x2, y2, xerr=x2err,yerr=y2err,alpha=1.0,markersize=3,fmt='bo')

binsx=30

binsy=30

ax_histx.hist(x, bins=binsx)

ax_histy.hist(y, bins=binsy, orientation='horizontal')

plt.savefig("test.png")

plt.show()

转载本文请联系原作者获取授权,同时请注明本文来自张书会科学网博客。

链接地址:http://blog.sciencenet.cn/blog-587102-1188874.html

上一篇:[转载]pycharm代码整体左移和右移缩进快捷键

下一篇:ubuntu18.04 install anaconda

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值