当前位置首页 > 软件编程 > python教程 > matplotlib绘制函数曲线,python matplotlib绘制折线图

matplotlib绘制函数曲线,python matplotlib绘制折线图

  matplotlib绘制函数曲线,python matplotlib绘制折线图

  我有两个情节,我想在一个数字上展示。我使用的数据是科学格式的,具有不同的指数幂。我能得到同样指数幂的图吗?以下是我目前最小的工作示例:将数组作为铭牌导入

  将matplotlib.pyplot作为血小板计数导入

  xdata=np.array([1,2,3,4,5])

  #数据集一

  ydata1=np.array([0.5e-11,0.6e-11,4.e-11,5.e-11,10.e-11])

  ydata1err=np.array([1.e-11,1.e-11,1.e-11,1.e-11,1.e-11,1.e-11])

  #数据集2

  ydata2=np.array([0.5e-11,0.6e-11,0.4e-11,0.5e-11,1.e-11])

  ydata2err=np.array([0.5e-11,0.5e-11,0.5e-11,0.5e-11,0.5e-11])

  #创建图形

  图=plt .图()

  ax=fig.add_subplot(111) #大支线剧情

  ax1=fig.add_subplot(211)

  ax2=fig.add_subplot(212)

  #绘图数据

  ax1.errorbar(xdata,ydata1,yerr=ydata1err,fmt=bo )

  ax2.errorbar(xdata,ydata2,yerr=ydata2err,fmt=ro )

  这将绘制两个范围为[0,1.e-10]和[0,1.e-11]的图形。我想要的是[0,1.e-10]和[0,0.1e-10]。在

  谢谢。在

本文来自网络,不代表菜鸟教程之家立场,转载请注明出处。
返回顶部