在matplotlib中缩放y轴

安库尔

我想在同一绘图中绘制多个绘图,因此我选择了二维列表,其中一个参数以字符串格式存储值,并且我使用for循环进行相同操作,但是当我在y轴上绘制较大值时低于较小的值这是可能有助于理解的代码段

m=['H','.','<','^','*','+','x','@']
    cnt=0
    for i in all:# here all has the row wise data to plot 
       matplotlib.pyplot.plot(l3,i,m[cnt])# l3 contains the values about the x axis
        cnt=cnt+1
    plt.xlabel("x")
    plt.ylabel("y")
    plt.legend(para,loc='best')# para contains the info about the y parameters

    plt.show()

像这样的图形来如何在图形中的0之上得到12000

这是我得到的缩放比例图,以便所有值在y轴上按升序排列

这是我得到的缩放比例图,以便所有值在y轴上按升序排列

谢尔多雷

您必须在绘制之前将字符串转换为浮点数

for i in all:# here all has the row wise data to plot 
    y = [float(ii) for ii in i]    
    matplotlib.pyplot.plot(l3, y, m[cnt])# l3 contains the values about the x axis
    cnt=cnt+1

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章