繁体   English   中英

故障设置 Plot y 轴使用 Python

[英]Trouble Setting Plot y-axis using Python

我正在尝试使用 matplotlib 绘制图表,但在设置 y 轴时遇到问题 - 感谢您的帮助!

plt.axes() 
plt.ylim([0, 150]) 
plt.yticks(np.arange(0, 150, 10))
 
plt.plot(df_merged['Year'], df_merged['Number of Grants'], label =
'Number of Grants') plt.plot(df_merged['Year'], df_merged['Number of Priorities'], label = 'Number of Priorities')

1个

看起来 y 轴的值可能是字符串——尝试将它们转换为整数/浮点数。 the.astype 方法可能有用

"11" > "105" 

在 Python 中计算为真。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM