-
sdr.plot.constellation(x_hat: NDArray[complex_], heatmap: bool =
False
, limits: tuple[float, float] | None =None
, **kwargs) Plots the constellation of the complex symbols \(\hat{x}[k]\).
- Parameters:¶
- x_hat: NDArray[complex_]¶
The complex symbols \(\hat{x}[k]\).
- heatmap: bool =
False
¶ If
True
, a heatmap is plotted instead of a scatter plot.- 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.- **kwargs¶
If
heatmap=False
, additional keyword arguments to pass tomatplotlib.pyplot.scatter()
. The following keyword arguments are set by default. The defaults may be overwritten."range"
: +/- 10% of the maximum value"bins"
: 75, which is the number of bins per axis
If
heatmap=True
, additional keyword arguments to pass tomatplotlib.pyplot.hist2d()
. The following keyword arguments are set by default. The defaults may be overwritten."marker"
:"."
"linestyle"
:"none"
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, 10_000); \ ...: x = qpsk.map_symbols(s); \ ...: x_hat = sdr.awgn(x, 6); ...: In [2]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.constellation(x_hat); ...:
Display the symbol constellation using a heatmap.
In [3]: plt.figure(figsize=(8, 4)); \ ...: sdr.plot.constellation(x_hat, heatmap=True); ...: