Traceback (most recent call last): File "E:\pythonProject\ADMM\wiene1.py", line 75, in <module> ax1.plot(t, compos

动态 未结 0 108
小小草
小小草 LV1 2023年9月23日 23:40 发表
This error occurs when trying to plot data using Matplotlib, and the x and y arrays have different lengths. In this specific case, the x array has a length of 1048576, while the y array has a length of 1048575. To fix this error, you need to ensure that the x and y arrays have the same length. One way to do this is to truncate the longer array to match the length of the shorter array. For example, you can modify the code to: ``` t = t[:len(composite_index)] ax1.plot(t, composite_index, color=color) ``` This will truncate the t array to match the length of the composite_index array, ensuring that both arrays have the same length and can be plotted together.
收藏(0)  分享
相关标签: 智能问答
问题没解决?让AI助手帮你作答 AI助手
0个回复
  • 消灭零回复