I do not want to connect points with lines. I know that for that I can use scatter. But, scatter does not work after plot.
So, basically I have to lists of points. The points from the first list I do want to connect with lines while the points from the second list should not be connect with lines.
How can one achieve it in matplotlib?
This is what I have tried:
plt.figure()
plt.plot(xys[:,0], xys[:,1], marker='o', color='g')
# WHAT SHOULD I DO HERE?
#plt.plot(xys_bad[:,0], xys_bad[:,1], color='r', linewidth=0.0, markersize = 10.0)
plt.scatter(xys_bad[:,0], xys_bad[:,1], color='r')
plt.show()
In the current versions of the IPython notebook and jupyter notebook, it is not necessary to use the %matplotlib inline function. As, whether you call matplotlib. pyplot. show() function or not, the graph output will be displayed in any case.
You can remove duplicate labels by putting them in a dictionary before calling legend . This is because dicts can't have duplicate keys.
%matplotlib inline is an example of a predefined magic function in Ipython. They are frequently used in interactive environments like jupyter notebook. %matplotlib inline makes your plot outputs appear and be stored within the notebook.
As describe in matplotlib documentation you should use the 'None'
linestyle
:
plt.plot(xys_bad[:,0], xys_bad[:,1], color='r', linestyle='None', markersize = 10.0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With