I am trying to produce a scatterplot WITHOUT lines connecting each marker using matplotlib.pyplot.plot(). I am using Python 2.
I have tried setting specifying in the plt.plot() function that linestyle='None'. I have also tried linestyle='' (this has no impact on the line) and linestyle=None (this raises an error). I have also tried setting the line width to 0, and I have tried altering the linestyle to a different type of dash. Neither worked.. the code ran without an error message and the connecting lines remained without alteration.
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
x=[0,1,2,3]
y=[2,4,6,8]
yError=[0.1,0.2,0.2,0.3]
fig = plt.figure(facecolor="w",figsize=(6.5,4.0))
ax = fig.add_subplot(111)
ax.plot(x, y, color='blue',marker='o',label='generic', linestyle='None')
ax.errorbar(x,y, yerr=yError, color='blue',label='_nolegend_')
plt.show()
The output I am hoping for is a scatterplot without connecteing lines.
plot()? Why don't you usescatterinstead? - pavel