Plotting¶
Zero relies on the powerful Matplotlib plotting library. In all cases, the plots produced by Zero can be further modified in ways supported by Matplotlib.
Plotting in analysis scripts¶
In scripts, plots are generated by the call to the solution’s
plot_responses() or plot_noise() methods. These support many
display options, as listed below. The return value from these methods is the
Figure, which can be
further modified.
After calling either plot_responses() or plot_noise(), you can
show the generated plots with show(). This method is called separately to allow
you to show a number of plots simultaneously.
Responses¶
-
Solution.plot_responses(figure=None, group=None, groups=None, source=None, sources=None, sink=None, sinks=None, xlabel=None, ylabel_mag=None, ylabel_phase=None, scale_db=True, **kwargs)[source] Plot responses.
Note: if only one of “sources” or “sinks” is specified, the other defaults to “all” as per the behaviour of
filter_responses().- Parameters
figure (
Figure, optional) – Figure to plot to. If not specified, a new figure is created.group, groups (
stror list ofstr, optional) – The response group(s) to plot. If None, the default group is assumed.source, sources, sink, sinks (
stror list ofstr,Component) – orNodeThe source(s) and sink(s) to plot responses between. If None, all matched sources and sinks are plotted.xlabel, ylabel_mag, ylabel_phase (
str, optional) – The x- and y-axis labels for the magnitude and phase plots.scale_db (
bool, optional) – Scale the magnitude y-axis values in decibels. If False, absolute scaling is used.
- Other Parameters
legend (
bool, optional) – Display legend.legend_loc (
str, optional) – Legend display location. Defaults to “best”.legend_groups (
bool, optional) – Display function group names in legends, if the group is not the default.title (
str, optional) – The plot title.xlim, mag_ylim, phase_ylim (sequence of
float, optional) – The lower and upper limits for the x- and y-axes for the magnitude and phase plots.db_tick_major_step, db_tick_minor_step (
float, optional) – The magnitude y axis tick step sizes whenscale_dbis enabled. Defaults to 20 and 10 for the major and minor steps, respectively.phase_tick_major_step, phase_tick_minor_step (
float, optional) – The phase y axis tick step sizes whenscale_dbis enabled. Defaults to 30 and 15 for the major and minor steps, respectively.
- Returns
BasePlotter– The plotter object.
Noise spectral densities¶
-
Solution.plot_noise(figure=None, group=None, groups=None, source=None, sources=None, sink=None, sinks=None, type=None, types=None, show_individual=True, show_sums=True, xlabel=None, ylabel=None, **kwargs)[source] Plot noise.
Note: if only some of “groups”, “sources”, “sinks”, “types” are specified, the others default to “all” as per the behaviour of
filter_noise().- Parameters
figure (
Figure, optional) – Figure to plot to. If not specified, a new figure is created.group, groups (
stror list ofstr, optional) – The noise group(s) to plot. If None, the default group is assumed.source, sources (
stror list ofstrorNoise, optional) – The noise source(s) to plot at the specifiedsinks. If None, all matched sources are plotted.sink, sinks (
stror list ofstr,ComponentorNode, optional) – The sink(s) to plot noise at. If None, all matched sinks are plotted.type, types (
stror list ofstr, optional) – The noise type(s) to plot. If None, all matched noise types are plotted.show_individual (
bool, optional) – Plot any individual noise spectra contained in this solution.show_sums (
bool, optional) – Plot any sums contained in this solution.xlabel, ylabel (
str, optional) – The x- and y-axis labels.
- Other Parameters
legend (
bool, optional) – Display legend.legend_loc (
str, optional) – Legend display location. Defaults to “best”.legend_groups (
bool, optional) – Display function group names in legends, if the group is not the default.title (
str, optional) – The plot title.xlim, ylim (sequence of
float, optional) – The lower and upper limits for the x- and y-axes.
- Returns
BasePlotter– The plotter object.
Further modifying plots generated by Zero¶
If you wish to apply further styling to a plot generated by Zero, you can do so using Matplotlib method calls on the figure property of the
plotter object.
You can also set the Solution’s response_plotter and
noise_plotter attributes to custom BaseGroupPlotter implementations to
provide full control over plotting capabilities.
Plotting from the command line¶
The LISO compatibility command line interface provides some options for controlling the display of plots and for saving copies to the file system. See LISO tools in the CLI section for more information.