【发布时间】:2019-11-09 15:48:10
【问题描述】:
我试图获得一个易于阅读的图表,但是当我使用 matplotlib.pyplot 绘制它时,y 轴的读数与 x 轴的读数不一致(y 轴从 26 到25 到 24 到 37 等)我做错了什么!
temp = ['26', '26', '25', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24', '24']
hum = ['37', '38', '38', '39', '39', '40', '40', '40', '40', '40', '40', '40', '40', '41', '40', '39', '39', '39', '39', '39', '39', '39', '39']
time = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 105, 110, 115]
plt.plot(time, temperature, color="green")
plt.plot(time, humidity, color="orange")
plt.xlabel("time (minutes)")
plt.ylabel("Temp/Humidity (C,%)")
plt.title("Temp and Humidity over time")
plt.show()
我的结果绘制正确,但在恒定方面绘制得很差
【问题讨论】:
标签: python matplotlib plot axis