Pyplot正在绘制x轴值错误

时间:2018-11-05 12:42:38

标签: python python-3.x matplotlib scatter-plot

我的X轴值为

 ['0.00001','0.0001','0.001','0.01','0.1','1','10','100']

我的Y轴值为:

[0.15425122872713898, 0.14390317295797253, 0.12573138520177873, 0.0984319101273864, 0.07160052158213247, 0.1640810458390451, 0.21749306228894313, 0.21759336654518707]

我正在尝试使用pyplot.scatter绘制散点图:

plt.scatter(x,y)

我的输出是:

output

x轴的'0.0001'值绘制在x轴的'1'值中。
怎么了?

1 个答案:

答案 0 :(得分:-2)

enter image description here问题是您缺少y的y轴值。 我尝试了这段代码,您可以看到结果

import matplotlib.pyplot as plt
 x= ['0.00001','0.0001','0.001','0.01','0.1','1','10','100'];
 y=['0.15425122872713898', '0.14390317295797253', '0.12573138520177873', '0.0984319101273864', '0.07160052158213247', '0.1640810458390451', '0.21749306228894313', '0.21759336654518707'];
plt.scatter(x,y);
plt.show();
相关问题