I would like to plot multiple columns of an array and label them all the same in the plot legend. However when using:
x = np.loadtxt('example_array.npy')
plt.plot(x[:,1:3],label = 'first 2 lines')
plt.plot(x[:,3:5],label = '3rd and 4th lines')
plt.legend()
I get as many legend labels as lines I have. So the above code yields four labels in the legend box.
There must be a simple way to assign a label for a group of lines?! But I cannot find it...
I would like to avoid having to resort to
x = np.loadtxt('example_array.npy')
plt.plot(x[:,1],label = 'first 2 lines')
plt.plot(x[:,1:3])
plt.plot(x[:,3],label = '3rd and 4th lines')
plt.plot(x[:,3:5])
plt.legend()
Thanks in advance