BasePlot#

class pyopenms_viz._core.BasePlot(data, x: str | None = None, y: str | None = None, z: str | None = None, kind=None, by: str | None = None, plot_3d: bool = False, relative_intensity: bool = False, subplots: bool | None = None, sharex: bool | None = None, sharey: bool | None = None, height: int | None = None, width: int | None = None, grid: bool | None = None, toolbar_location: str | None = None, fig: 'figure' | None = None, title: str | None = None, xlabel: str | None = None, ylabel: str | None = None, zlabel: str | None = None, x_axis_location: str | None = None, y_axis_location: str | None = None, title_font_size: int | None = None, xaxis_label_font_size: int | None = None, yaxis_label_font_size: int | None = None, xaxis_tick_font_size: int | None = None, yaxis_tick_font_size: int | None = None, annotation_font_size: int | None = None, line_type: str | None = None, line_width: float | None = None, min_border: int | None = None, show_plot: bool | None = None, aggregate_duplicates: bool | None = None, legend: LegendConfig | Dict | None = None, feature_config: FeatureConfig | Dict | None = None, _config: _BasePlotConfig | None = None, **kwargs)#

Bases: ABC

This class shows functions which must be implemented by all backends

__init__(data, x: str | None = None, y: str | None = None, z: str | None = None, kind=None, by: str | None = None, plot_3d: bool = False, relative_intensity: bool = False, subplots: bool | None = None, sharex: bool | None = None, sharey: bool | None = None, height: int | None = None, width: int | None = None, grid: bool | None = None, toolbar_location: str | None = None, fig: 'figure' | None = None, title: str | None = None, xlabel: str | None = None, ylabel: str | None = None, zlabel: str | None = None, x_axis_location: str | None = None, y_axis_location: str | None = None, title_font_size: int | None = None, xaxis_label_font_size: int | None = None, yaxis_label_font_size: int | None = None, xaxis_tick_font_size: int | None = None, yaxis_tick_font_size: int | None = None, annotation_font_size: int | None = None, line_type: str | None = None, line_width: float | None = None, min_border: int | None = None, show_plot: bool | None = None, aggregate_duplicates: bool | None = None, legend: LegendConfig | Dict | None = None, feature_config: FeatureConfig | Dict | None = None, _config: _BasePlotConfig | None = None, **kwargs) None#
__weakref__#

list of weak references to the object

_check_and_aggregate_duplicates()#

Check if duplicate data is present and aggregate if specified. Modifies self.data

property _interactive: bool#

Whether the plot is interactive. Must be overridden by subclasses

abstract property _kind: str#

The kind of plot to assemble. Must be overridden by subclasses.

abstract _modify_x_range(x_range: Tuple[float, float], padding: Tuple[float, float] | None = None)#

Modify the x-axis range.

Parameters:
  • x_range (Tuple[float, float]) – The desired x-axis range.

  • padding (Tuple[float, float] | None, optional) – The padding to be applied to the x-axis range, in decimal percent. Defaults to None.

abstract _modify_y_range(y_range: Tuple[float, float], padding: Tuple[float, float] | None = None)#

Modify the y-axis range.

Parameters:
  • y_range (Tuple[float, float]) – The desired y-axis range.

  • padding (Tuple[float, float] | None, optional) – The padding to be applied to the x-axis range, in decimal percent. Defaults to None.

_separate_class_kwargs(**kwargs)#

Separates the keyword arguments into class-specific arguments and other arguments.

Parameters:

**kwargs – Keyword arguments passed to the method.

Returns:

A dictionary containing the class-specific keyword arguments. other_kwargs: A dictionary containing the remaining keyword arguments.

Return type:

class_kwargs

_update_from_config(config) None#

Updates the plot configuration based on the provided config object.

Parameters:

config (Config) – The configuration object containing the plot settings.

Returns:

None

_verify_column(colname: str | int, name: str) str#

fetch data from column name

Parameters:
  • colname (str | int) – column name of data to fetch or the index of the column to fetch

  • name (str) – name of the column e.g. x, y, z for error message

Returns:

pandas series or None

Return type:

pd.Series

Raises:
  • ValueError – if colname is None

  • KeyError – if colname is not in data

  • ValueError – if colname is not numeric

generate(**kwargs)#

Generate the plot

property known_columns: List[str]#

List of known columns in the data, if there are duplicates outside of these columns they will be grouped in aggregation if specified

abstract plot(fig, data, x, y, by: str | None = None, plot_3d: bool = False, **kwargs)#

Create the plot