I have 2 ndarrays A and B containing 3 columns each. Columns of A and B are corresponding and I would like to plot each corresponding column of A and B as lines in the same color, one dashed, one solid. I got this bit of code, but of course at the 2nd plot()
command, pyplot continues w/ the next color in the color map:
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0, 10, 1)
A = np.array([[1] * 10, [5] * 10, [10] * 10])
B = np.array([[4] * 10, [20] * 10, [40] * 10])
plt.figure(1)
plt.plot(t, A.T, label=['A_1', 'A_2', 'A_3'])
plt.plot(t, B.T, linestyle='--', label=['B_1', 'B_2', 'B_3'])
plt.legend()
plt.show()
I would like to force pyplot.plot()
to start over with the first color of the color map or any other nice way to achive the desired result. I could plot by iterating over the columns of both ndarrays and set specific colors for each iteration, but it seems to me there should be a shorter and more elegant solution. Any thoughts on that? Thanks!