Plotter
BasePlot
Base class for plotting graphs, implementing common functionality for all plots.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ax
|
Axes
|
Matplotlib |
required |
title
|
str
|
Plot title. |
''
|
labels
|
Optional[List[str]]
|
List of axis labels. |
None
|
xlim
|
Optional[Tuple[float, float]]
|
Limits of the x-axis |
None
|
ylim
|
Optional[Tuple[float, float]]
|
Limits of the y-axis |
None
|
colors
|
Optional[Union[str, List[str]]]
|
Plot colors. |
None
|
style
|
Optional[Dict[str, Any]]
|
Plot style. |
None
|
GainPatternPlot
Bases: BasePlot
Example
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ax
|
Axes
|
Matplotlib |
required |
title
|
str
|
Plot title. |
'Diagrama de Irradiação (dBi)'
|
labels
|
Optional[List[str]]
|
List of axis labels. |
required |
xlim
|
Optional[Tuple[float, float]]
|
Limits of the x-axis |
required |
ylim
|
Optional[Tuple[float, float]]
|
Limits of the y-axis |
required |
colors
|
Optional[Union[str, List[str]]]
|
Plot colors. |
None
|
style
|
Optional[Dict[str, Any]]
|
Plot style. |
None
|
TimePlot
Bases: BasePlot
Class for plotting signals in the time domain, receiving a time vector \(t\), and a list of signals \(s(t)\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fig
|
Figure
|
Figure object |
required |
grid
|
GridSpec
|
GridSpec object |
required |
pos
|
int
|
Plot position |
required |
t
|
ndarray
|
Time vector |
required |
signals
|
Union[ndarray, List[ndarray]]
|
Signal or list of signals \(s(t)\). |
required |
time_unit
|
str
|
Time unit for plotting ("ms" by default, can be "s"). |
'ms'
|
amp_norm
|
bool
|
Signal normalization for maximum amplitude |
False
|
Examples:
- Modulator Time Domain Example:
- AWGN addition Time Domain Example:
FrequencyPlot
Bases: BasePlot
Class for plotting signals in the frequency domain, receiving a sampling frequency \(f_s\) and a signal \(s(t)\) and performing the Fourier transform of the signal, according to the expression below.
Where
- \(S(f)\): Signal in the frequency domain.
- \(s(t)\): Signal in the time domain.
- \(\mathcal{F}\): Fourier transform.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fig
|
Figure
|
Figure object |
required |
grid
|
GridSpec
|
GridSpec object |
required |
pos
|
int
|
Plot position |
required |
fs
|
float
|
Sampling frequency |
required |
signal
|
ndarray
|
Signal to be plotted |
required |
fc
|
float
|
Central frequency |
0.0
|
Examples:
- Modulator Frequency Domain Example:
- AWGN addition Frequency Domain Example:
TxRxSignalPlot
Bases: BasePlot
Plotador de sinais TX e RX em dB, recebendo vetores diretamente, seguindo o padrão do plotter.py (herda BasePlot).
FrequencyResponsePlot
Bases: BasePlot
Plot the frequency response of a filter from its coefficients (b, a).
Calculates the Discrete Fourier Transform of the impulse response using scipy.signal.freqz.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fig
|
Figure
|
Figure of the plot |
required |
grid
|
GridSpec
|
GridSpec of the plot |
required |
pos
|
int
|
Position in the GridSpec |
required |
b
|
ndarray
|
Coefficients of the numerator of the filter |
required |
a
|
ndarray
|
Coefficients of the denominator of the filter |
required |
fs
|
float
|
Sampling frequency |
required |
f_cut
|
Optional[float]
|
Cut-off frequency of the filter (Hz) |
None
|
xlim
|
Optional[Tuple[float, float]]
|
Limit of the x-axis (Hz) |
None
|
worN
|
int
|
Number of points for the Discrete Fourier Transform |
1024
|
show_phase
|
bool
|
If |
False
|
xlabel
|
str
|
Label of the x-axis |
'Frequency (Hz)'
|
ylabel
|
str
|
Label of the y-axis |
'Magnitude (dB)'
|
Examples:
- Frequency Domain Plot Example:
create_figure(rows, cols, figsize=(16, 9))
Creates a figure with GridSpec, returning the fig and grid objects for plotting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rows
|
int
|
Number of rows in the GridSpec |
required |
cols
|
int
|
Number of columns in the GridSpec |
required |
figsize
|
Tuple[int, int]
|
Figure size |
(16, 9)
|
Returns:
| Type | Description |
|---|---|
Tuple[Figure, GridSpec]
|
Tuple[plt.Figure, gridspec.GridSpec]: Tuple with the figure and GridSpec objects |
save_figure(fig, filename, out_dir='../../../assets')
Saves the figure in <out_dir>/<filename> from the script root directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fig
|
Figure
|
Matplotlib |
required |
filename
|
str
|
Output file name |
required |
out_dir
|
str
|
Output directory |
'../../../assets'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the output directory is invalid |