PLOTLYPlot#

class pyopenms_viz._plotly.PLOTLYPlot(data: DataFrame, config: BasePlotConfig = None, **kwargs)#

Bases: BasePlot, ABC

Base class for assembling a Ploty plot

_create_figure()#

Create a new figure, if a figure is not supplied

property _interactive: bool#

Whether the plot is interactive. Must be overridden by subclasses

_load_extension()#

Tries to load the plotly extensions, if not throw an import error

_modify_x_range(x_range: Tuple[float, float] | None = None, 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.

_modify_y_range(y_range: Tuple[float, float] | None = None, 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.

_update_plot_aes(**kwargs) None#

Update the plot aesthetics.

generate(tooltips, custom_hover_data, fixed_tooltip_for_trace=True) Figure#

Generate the Plotly plot with optional interactive tooltips.

Parameters:
  • tooltips – A Plotly hovertemplate string that defines the tooltip format. Can reference customdata fields using %{customdata[0]}, etc.

  • custom_hover_data – A numpy array of additional data for hover tooltips. Shape depends on fixed_tooltip_for_trace setting.

  • fixed_tooltip_for_trace (bool) – If True, each trace gets one row of custom_hover_data repeated for all points. If False, custom_hover_data rows are distributed sequentially across all trace points.

Returns:

The generated Plotly figure.

Return type:

Figure