Python matplotlib.stem without markers

How can I build a section of steam without markers (steam lines only) ?. This is especially useful when building really long arrays of signals.

Thanks!

+5
source share
1 answer

You can simply set the marker as nothing:

enter image description here

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:

enter image description here

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.

+13
source

Source: https://habr.com/ru/post/1203411/


All Articles