You can simply set the marker as nothing:

import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 6*np.pi, 200) y = np.sin(x) plt.stem(x, y, markerfmt=" ") plt.show()
There are several ways in matplotlib to use โnothingโ as a marker, and each gives a slightly different result. For example, using "" instead of " " will connect the ends of the stem to the line:

Also, btw, I first tried to use the pixel marker indicated by "," , but that pixel was not very well aligned with the stem and did not look very good.
tom10 source share