几种常用作图

做热图

import seaborn as sns;
sns.set()
plt.figure(dpi=400)
ax1 = sns.heatmap(A,cmap="YlGnBu",vmin=-0.8,vmax=0.8,annot=True,fmt=".2f",annot_kws={'size':5})

plt.title('H0_1')
plt.show()
    

直方图

    x = np.arange(20)
    total_width, n = 0.8, 2
    width = total_width / n
    x = x - (total_width - width) / 2
    plt.barh(x, e2, height=width, label='e3')
    plt.barh(x + width, e2, height=width, label='e4')
    plt.xlabel("energy")
    plt.legend()
    plt.show()

误差图

    x = np.array([100, 1000, 10000, 100000,1000000])
    dy = np.array([0.046882158,0.007782108,0.004341331,0.001801209,0.00024765])
    y = np.array([0.596939253, 0.093611854, 0.013429654, 0.002950581, 0.000327617])

    plt.axes(yscale="log",xscale="log")  # 双log坐标系
    # plt.errorbar(x, y, yerr=dy, fmt='o', ecolor='r', color='b', elinewidth=2, capsize=4)
    
    for x1, y1 in zip(x, y): # 给每个点备注数值
        plt.text(x1, y1 + 0.01, '%.2e' % y1, ha='center', va='bottom', fontsize=9)
    #.2e表示科学计数法,保留2位。正常是.2d 保留两位小数

    plt.title("title")
    plt.ylabel("Y")
    plt.xlabel("X")
    plt.show()

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值