How do you create a 'pin plot' in matplotlib, or is another library required? The code I have to plot points is below. The top plot is the output of my code, the second is the ideal output.
def getData(n):
data = []
for i in range(n):
data.append(i)
return data
fig, axs = plt.subplots(2, 2)
n = 10
axs[0, 0].scatter([i for i in range(n)], getData(n))
plt.show()


This is called a stem plot in matplotlib:
plt.stem(range(10), markerfmt='None', basefmt='C0-')

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