python - 如何用 x 轴从两个数组中绘制图形将是两个数组的长度?
问题描述
array1=[1,2,3,4]
array2=[5,6,7,8]
plt.plot(4, array1, 'g', label='Label 1')
plt.plot(4, array2, 'b', label='Label 2')
plt.title('Sample Graph')
plt.xlabel('X Axis')
plt.ylabel('Y Axis')
plt.legend()
plt.show()
但是当我运行它时它说
ValueError: x and y must have same first dimension, but have shapes (1,) and (4,)
解决方案
推荐阅读
- c# - ASP.NET CSHTML 填充 Gridview
- java - 如何从静态工厂方法绑定静态嵌套类的泛型类型?
- java - java - 如何使用Java Spring仅在浏览器的一部分中显示pdf文件?
- android - Android 模拟器无法在 Windows 10 中启动,退出代码为 -805306369
- php - 如何将付款存储到数据库中的多个表中
- nginx - 双代理的 Nginx Websocket 配置
- python - Python,解析30MB文件时遇到内存错误(已经下载到我的本地计算机中)
- javascript - 如何使用 onClick() 过滤 React Bootstrap Card
- ag-grid - ag-grid:多列排序中支持的最大列数
- javascript - 如何通过 jQuery 设置 textarea 值并触发一些事件,就像用户输入一些东西一样