Matplotlib, can build, but not scatter

I have strange behavior matplotlib.pyplot. I have two arrays x and y. I want to scatter these points. so I use the scatter function:

ax.scatter(x, y, 'r') plt.xlabel('average revsion size') plt.ylabel('time (seconds)') plt.savefig('time.png', format='png') 

this piece of code gives me an error otImplementedError: Not implemented for this type But if I replace plt.scatter with plt.plot, it will speak. What is the problem?

Also, if I use plt.show (), it opens 25 windows (25 - length x). Any ideas?

+7
source share
1 answer

The fact is that scatter and plot do not accept arguments in the same order. Try using scatter(x, y, c='r') instead (assuming it was the coloring you intended to install). Take a look at the documentation for scatter .

 from matplotlib import pyplot as plt x = [1,2,3,4,5,6] y = [2,4,6,3,1,5] plt.scatter(x, y, c='r') plt.show() 
+12
source

All Articles