plot_compare§
- typed_lisa_toolkit.plot_compare(obj1, obj2, /, fig=None, ax=None, *, plot_mode=None, set_legend=True, showdiff=False, **kwargs)[source]§
Plot two objects for comparison, with optional difference view.
This function provides a unified interface for comparing two compatible objects. Both objects are plotted with consistent scaling and units. Optionally, the difference between the two objects can be displayed in a side column.
- Parameters:
obj1 – The first object to plot. Positional-only.
obj2 – The second object to plot. Must be of the same type as obj1. Positional-only.
fig (
matplotlib.figure.Figure, optional) – The figure to plot into. If not provided, a new figure will be created.ax (
matplotlib.axes.Axes, optional) – The axes to plot into. If provided, fig must also be provided. Can not be specified when plotting multi-channel objects or when showdiff=True.plot_mode (
{'loglog', 'semilogx', 'semilogy', 'plot', 'imshow'}, optional) – The plotting mode to use. If not specified, a default mode is selected based on the object type. The same mode is applied to both objects and the difference plot (if shown).showdiff (
bool, defaultFalse) – Whether to display the difference (obj1 - obj2). If True, the difference is shown in a side column. Difference display is not supported forPhasorobjects.set_legend (
bool, defaultTrue) – Whether to display a legend on the plots.**kwargs (
PlotKwargs) –Additional keyword arguments passed to matplotlib or figure creation. Common options include:
Figure kwargs: figsize, dpi, constrained_layout
Subplot kwargs: sharex, sharey, wspace, hspace
Line kwargs: color, linewidth, linestyle, label
Image kwargs: cmap, vmin, vmax
- Returns:
fig (
matplotlib.figure.Figure) – The figure containing the plots.axs (
list[list[matplotlib.axes.Axes]]) – The axes containing the plots, organized as a list of rows of axes, where a row is itself a list of axes.
- Raises:
TypeError – If either obj1 or obj2 is not a plottable type.
ValueError – If the objects are incompatible for comparison, or if ax is provided without fig.
NotImplementedError – If the objects have a sparse grid or other configuration yet to be supported.
See also
plot()More details on plotting behavior, unit normalization, and supported types.