I want to use the plot method of the matplotlib and plot 2 arrays. The array to be plotted along the x-axis has 1 row and 128 columns [1,128]. The array to be plotted along the y-axis has 14 rows and 128 columns [14,128]. When I try to use the plot method, it returns this message:
ValueError: x and y must have same first dimension
This is the code that I am using to plot it. a and b are the 2 arrays.
line, = plt.plot(b, a, 'bs', markersize=4)
You’ve just got your arrays the wrong way around. Transpose them and everything should work.