首页 > 编程语言 > 详细

python画点线图

时间:2021-08-02 11:10:44      阅读:18      评论:0      收藏:0      [点我收藏+]

参考自:https://www.jianshu.com/p/82b2a4f66ed7?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

比较重要的是:
plt.plot(x, y, "c*-", ...)其中的"c*-"的 c 表示 cyan 是点的颜色,* 表示五角星 是点的形状,- 表示实线 是线的类型。
plt.legend() 表示显示各组点线的 label。

import numpy as np
import matplotlib.pyplot as plt
sd_Np=[2,4,6]
pf_Np=[2,4,6,8,10]
sdg7h11_Np=[2,4,6,8,10,12,14,16]
sd_t_iter=np.log([14,15,17])
pf_t_iter=np.log([136,144,155,172,202])
sdg7h11_t_iter=np.log([1700,1600,1710,1840,2000,2300,2600,3000])
plt.plot(sd_Np,sd_t_iter, "c*-", label="sd shell")
plt.plot(pf_Np,pf_t_iter, "gv-", label="pf shell")
plt.plot(sdg7h11_Np,sdg7h11_t_iter, "ro-", label="sdg7h11 shell")
plt.xlabel("Valence proton number $N_p$, with $N_n = N_p$",fontsize=14)
plt.ylabel("ln $t_{iter}$ (s)", fontsize=15)
plt.legend()
#plt.title("Timing for one iteration in the conjugate gradient method.",fontsize=14)
plt.savefig("t_iter.jpg")
#print(np.log(12), np.log(20), np.log(32))

python画点线图

原文:https://www.cnblogs.com/luyi07/p/15088531.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!