Suppose I have a set of points x and a set of corresponding data y. I now plot these in a scatter plot, plt.scatter(x,y). The figure I
x
y
plt.scatter(x,y)
Well, there is a stem method, much easier to use:
import matplotlib.pyplot as plt import numpy as np x, y = np.random.random((2, 20)) fig, ax = plt.subplots() ax.stem(x, y, markerfmt=' ') plt.show()
If you want bullets on the top of lines, just remove markerfmt.
markerfmt