bag.data.plot
This module contains utilities to improve waveform plotting in python.
Module Contents
Classes
A custom matplotlib interactive plotting class. |
|
Functions
|
Create a WaveformPlotter. |
|
Plot waveforms in vertical panels with shared X axis. |
|
|
|
|
|
Draws an anti-aliased line in img from p1 to p2 with the given color. |
|
Plot eye diagram heat map. |
|
Plot eye diagram. |
|
Find point on PWL waveform described by xvec, yvec closest to (x, y) |
Attributes
- bag.data.plot.color_cycle = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f',...[source]
- bag.data.plot.figure(fig_id, picker=5.0)[source]
Create a WaveformPlotter.
- Parameters:
- Returns:
plotter – a plotter that helps you make interactive matplotlib figures.
- Return type:
- bag.data.plot.plot_waveforms(xvec, panel_list, fig=1)[source]
Plot waveforms in vertical panels with shared X axis.
- Parameters:
xvec (
numpy.ndarray
) – the X data.panel_list (list[list[(str,
numpy.ndarray
)]]) – list of lists of Y data. Each sub-list is one panel. Each element of the sub-list is a tuple of signal name and signal data.fig (int) – the figure ID.
- bag.data.plot.draw_line(x0, y0, x1, y1, xmax, grid)[source]
Draws an anti-aliased line in img from p1 to p2 with the given color.
- bag.data.plot.plot_eye_heatmap(fig, tvec, yvec, tper, tstart=None, tend=None, toff=None, tstep=None, vstep=None, cmap=None, vmargin=0.05, interpolation='gaussian', repeat=False)[source]
Plot eye diagram heat map.
- Parameters:
fig (int) – the figure ID.
tvec (np.ndarray) – the time data.
yvec (np.ndarray) – waveform data.
tper (float) – the eye period.
tstart (float) – starting time. Defaults to first point.
tend (float) – ending time. Defaults to last point.
toff (float) – eye offset. Defaults to 0.
tstep (float or None) – horizontal bin size. Defaults to using 200 bins.
vstep (float or None) – vertical bin size. Defaults to using 200 bins.
cmap – the colormap used for coloring the heat map. If None, defaults to cubehelix_r
vmargin (float) – vertical margin in percentage of maximum/minimum waveform values. Defaults to 5 percent. This is used so that there some room between top/bottom of eye and the plot.
interpolation (str) – interpolation method. Defaults to ‘gaussian’. Use ‘none’ for no interpolation.
repeat (bool) – True to repeat the eye diagram once to the right. This is useful if you want to look at edge transistions.
- bag.data.plot.plot_eye(fig, tvec, yvec_list, tper, tstart=None, tend=None, toff_list=None, name_list=None, alpha=1.0)[source]
Plot eye diagram.
- Parameters:
fig (int) – the figure ID.
tvec (np.ndarray) – the time data.
yvec_list (list[np.ndarray]) – list of waveforms to plot in eye diagram.
tper (float) – the period.
tstart (float) – starting time. Defaults to first point.
tend (float) – ending time. Defaults to last point.
toff_list (list[float]) – offset to apply to each waveform. Defaults to zeros.
name_list (list[str] or None) – the name of each waveform. Defaults to numbers.
alpha (float) – the transparency of each trace. Can be used to mimic heatmap.
- bag.data.plot._find_closest_point(x, y, xvec, yvec, xnorm, ynorm)[source]
Find point on PWL waveform described by xvec, yvec closest to (x, y)
- class bag.data.plot.WaveformPlotter(fig_idx, picker=5.0, normal_width=1.5, select_width=3.0)[source]
Bases:
object
A custom matplotlib interactive plotting class.
This class adds many useful features, such as ability to add/remove markers, ability to toggle waveforms on and off, and so on.
- Parameters: