I am plotting an array A
which has len(A)=2
. I want to plot A[0],A[1]
with separate colors on the same graph, not a single color as shown in the current output and also add legends for each A[0],A[1]
.
import numpy as np
import matplotlib.pyplot as plt
A=np.array([[[0.02109 ],
[0.02109 ],
[0.0201082 ],
[0.02109 ],
[0.02109 ],
[0.02109 ],
[0.02055473],
[0.02055797],
[0.02109 ],
[0.02109 ],
[0.02109 ],
[0.02109 ]],
[[0.02109 ],
[0.02109 ],
[0.01127196],
[0.02109 ],
[0.02109 ],
[0.02109 ],
[0.01573726],
[0.01576968],
[0.02109 ],
[0.02109 ],
[0.02109 ],
[0.02109 ]]])
plt.title("Line graph")
for i in range(0,len(A)):
plt.plot(A[i], color="red", ls='', marker='o')
plt.xlabel('Node number')
plt.ylabel('IFT (mN/m)')
The current output is