-
sdr.plot.stem[_ScalarType_co](x: ndarray[Any, dtype[_ScalarType_co]], *, color: str | None =
None
, ax: Axes | None =None
, **kwargs) -
sdr.plot.stem[_ScalarType_co](x: ndarray[Any, dtype[_ScalarType_co]], y: ndarray[Any, dtype[_ScalarType_co]], *, color: str | None =
None
, ax: Axes | None =None
, **kwargs) Wraps
matplotlib.pyplot.stem()
to style the plot more like MATLAB.- Parameters:¶
- x: ndarray[Any, dtype[_ScalarType_co]]¶
The x-coordinates of the stem plot.
- y: ndarray[Any, dtype[_ScalarType_co]]
The y-coordinates of the stem plot.
- color: str | None =
None
¶ The color of the stem line and marker. If
None
, the next color in the current color cycle is used.- ax: Axes | None =
None
¶ The axis to plot on. If
None
, the current axis is used.- **kwargs¶
Additional keyword arguments to pass to
matplotlib.pyplot.stem()
.
Notes
This function is a wrapper around
matplotlib.pyplot.stem()
that styles the plot more like MATLAB’sstem()
. It removes the base line and sets the stem line color and marker color to the next color in the current color cycle. It also sets the marker face color to none.Examples
Compare the
matplotlib.pyplot.stem()
plot to the styledsdr.plot.stem()
plot.In [1]: rrc = sdr.raised_cosine(0.1, 8, 10) In [2]: plt.figure(); \ ...: plt.stem(rrc); \ ...: plt.title("matplotlib.pyplot.stem()"); ...: In [3]: plt.figure(); \ ...: sdr.plot.stem(rrc); \ ...: plt.title("sdr.plot.stem()"); ...:
The standard plot is even more unreadable when multiple stem plots are on the same axes.
In [4]: gaussian = sdr.gaussian(0.1, 8, 10) In [5]: plt.figure(); \ ...: plt.stem(rrc); \ ...: plt.stem(gaussian); \ ...: plt.title("matplotlib.pyplot.stem()"); ...: In [6]: plt.figure(); \ ...: sdr.plot.stem(rrc); \ ...: sdr.plot.stem(gaussian); \ ...: plt.title("sdr.plot.stem()"); ...: