import numpy as np
import matplotlib.pyplot as plt array = np.array([[1,2,3,4,5,6],[10,20,30,40,50,60],[3,4,5,6,7,8],[100,200,300,400,500,600]])def plot(list):fig = plt.figure()ax = fig.add_subplot(111)for a,i in enumerate(list.T):ax.scatter(i[0],i[1],c='red') # This is plottedax.plot(i[2],i[3],'g--') # THIS IS NOT BEING PLOTTED !!!! fig.show()plot(array)
Now, I need to call plot
several times using different array
lists. So my for
loop cannot be removed. Is there any other way to plot a dotted line apart from calling plt.plot
instead ?
This is the plot I get:
As you can see, I am not getting the plt.plot(i[2],i[3],'g--')
. Why is this so ?
But when you print the values using the same for loop:
In [21]: for a,i in enumerate(array.T):...: print i[2],i[3]...:
3 100
4 200
5 300
6 400
7 500
8 600
The values are perfectly printed. They however are not plotted.