-
sdr.plot.constellation(x_hat: NDArray[complex_], limits: tuple[float, float] | None =
None, persistence: bool =False, colorbar: bool =True, **kwargs) Plots the constellation of the complex symbols \(\hat{x}[k]\).
- Parameters:¶
- x_hat: NDArray[complex_]¶
The complex symbols \(\hat{x}[k]\).
- limits: tuple[float, float] | None =
None¶ The axis limits, which apply to both the x- and y-axis. If
None, the axis limits are set to 10% larger than the maximum value.- persistence: bool =
False¶ Indicates whether to plot the points as a persistence plot. A persistence plot is a 2D histogram of the points.
- colorbar: bool =
True¶ Indicates whether to add a colorbar to the plot. This is only added if
persistence=True.- **kwargs¶
Additional keyword arguments to pass to Matplotlib functions.
If
persistence=False, the following keyword arguments are passed tomatplotlib.pyplot.scatter(). The defaults may be overwritten."marker":".""linestyle":"none"
If
persistence=True, the following keyword arguments are passed tonumpy.histogram2d()andmatplotlib.pyplot.pcolormesh(). The defaults may be overwritten."range": +/- 10% of the maximum value"bins":100 # Number of bins per axis"cmap":"rainbow""show_zero":False
Example¶
Display the symbol constellation for Gray-coded QPSK at 6 dB \(E_s/N_0\).
In [1]: qpsk = sdr.PSK(4, phase_offset=45); \ ...: s = np.random.randint(0, qpsk.order, 100_000); \ ...: x = qpsk.map_symbols(s); \ ...: x_hat = sdr.awgn(x, 6); ...: In [2]: plt.figure(); \ ...: sdr.plot.constellation(x_hat[0:1_000]) ...:
Display the symbol constellation using a persistence plot.
In [3]: plt.figure(); \ ...: sdr.plot.constellation(x_hat, persistence=True) ...: