petab.visualize.plotter

PEtab visualization plotter classes

Classes

MPLPlotter(figure, data_provider)

Matplotlib wrapper

Plotter(figure, data_provider)

Plotter abstract base class.

SeabornPlotter(figure, data_provider)

Seaborn wrapper.

class petab.visualize.plotter.MPLPlotter(figure: Figure, data_provider: DataProvider)[source]

Bases: Plotter

Matplotlib wrapper

static _error_column_for_plot_type_data(plot_type_data: str) str | None[source]

Translate PEtab plotTypeData value to column name of internal data representation

Parameters:
  • plot_type_data (PEtab plotTypeData value (the way replicates) –

  • handled) (should be) –

Return type:

Name of corresponding column

static _line_plot_at_t_inf(ax: Axes, plotTypeData: str, measurements_to_plot: DataSeries, simulations_to_plot: DataSeries, noise_col: str, label_base: str, split_axes_params: dict, color=None) Tuple[Axes, Axes][source]

Plot data at t=inf.

Parameters:
  • ax – Axis object for the data corresponding to the finite timepoints.

  • plotTypeData – The way replicates should be handled.

  • measurements_to_plot – Measurements to plot.

  • simulations_to_plot – Simulations to plot.

  • noise_col – The name of the error column for plot_type_data.

  • label_base – Label base.

  • split_axes_params – A dictionary of split axes parameters with - Axis object for the data corresponding to t=inf - Time value that represents t=inf - left and right limits for the axis where the data corresponding to the finite timepoints is plotted

  • color – Line color.

Returns:

  • Two axis objects (for the data corresponding to the finite timepoints)

  • and for the data corresponding to t=inf

static _postprocess_splitaxes(ax: Axes, ax_inf: Axes, t_inf: float) None[source]

Postprocess the splitaxes: set axes limits, turn off unnecessary ticks and plot dashed lines highlighting the gap in the x axis.

Parameters:
  • ax – Axis object for the data corresponding to the finite timepoints.

  • ax_inf – Axis object for the data corresponding to t=inf.

  • t_inf – Time value that represents t=inf

_preprocess_splitaxes(fig: Figure, ax: Axes, subplot: Subplot) Dict[source]

Prepare splitaxes if data at t=inf should be plotted: compute left and right limits for the axis where the data corresponding to the finite timepoints will be plotted, compute time point that will represent t=inf on the plot, create additional axes for plotting data at t=inf.

static _square_plot_equal_ranges(ax: Axes, lim: List | Tuple | None = None) Axes[source]

Square plot with equal range for scatter plots.

Return type:

Updated axis object.

generate_barplot(ax: Axes, dataplot: DataPlot, plotTypeData: str) None[source]

Generate barplot.

Parameters:
  • ax – Axis object.

  • dataplot – Visualization settings for the plot.

  • plotTypeData – Specifies how replicates should be handled.

generate_figure(subplot_dir: str | None = None, format_: str = 'png') Dict[str, Axes] | None[source]

Generate the full figure based on the markup in the figure attribute.

Parameters:
  • subplot_dir – A path to the folder where single subplots should be saved. PlotIDs will be taken as file names.

  • format – File format for the generated figure. (See matplotlib.pyplot.savefig() for supported options).

Returns:

  • ax – Axis object of the created plot.

  • None – In case subplots are saved to file.

generate_lineplot(ax: Axes, dataplot: DataPlot, plotTypeData: str, splitaxes_params: dict) Tuple[Axes, Axes][source]

Generate lineplot.

It is possible to plot only data or only simulation or both.

Parameters:
  • ax – Axis object.

  • dataplot – Visualization settings for the plot.

  • plotTypeData – Specifies how replicates should be handled.

  • splitaxes_params

generate_scatterplot(ax: Axes, dataplot: DataPlot, plotTypeData: str) None[source]

Generate scatterplot.

Parameters:
  • ax – Axis object.

  • dataplot – Visualization settings for the plot.

  • plotTypeData – Specifies how replicates should be handled.

generate_subplot(fig: Figure, ax: Axes, subplot: Subplot) None[source]

Generate subplot based on markup provided by subplot.

Parameters:
  • fig – Figure object.

  • ax – Axis object.

  • subplot – Subplot visualization settings.

class petab.visualize.plotter.Plotter(figure: Figure, data_provider: DataProvider)[source]

Bases: ABC

Plotter abstract base class.

figure

Figure instance that serves as a markup for the figure that should be generated

data_provider

Data provider

class petab.visualize.plotter.SeabornPlotter(figure: Figure, data_provider: DataProvider)[source]

Bases: Plotter

Seaborn wrapper.