MATPLOTLIBLinePlot#
- class pyopenms_viz._matplotlib.MATPLOTLIBLinePlot(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:
MATPLOTLIBPlot
,LinePlot
Class for assembling a matplotlib line plot
- classmethod plot(ax, data, x, y, by: str | None = None, plot_3d=False, **kwargs) Tuple[Axes, 'Legend'] #
Plot a line plot
Plot method for creating plots from a Pandas DataFrame.
- Parameters:
data (pandas.DataFrame or numpy.ndarray) – The data to be plotted.
x (str or None, optional) – The column name for the x-axis data.
y (str or None, optional) – The column name for the y-axis data.
z (str or None, optional) – The column name for the z-axis data (for 3D plots).
kind (str, optional) – The kind of plot to create. One of: (‘line’, ‘vline’, ‘scatter’, ‘chromatogram’, ‘mobilogram’, ‘spectrum’, ‘peakmap’)
by (str or None, optional) – Column in the DataFrame to group by.
relative_intensity (bool, default False) – Whether to use relative intensity for the y-axis.
subplots (bool or None, optional) – Whether to create separate subplots for each column.
sharex (bool or None, optional) – Whether to share x or y axes among subplots.
sharey (bool or None, optional) – Whether to share x or y axes among subplots.
height (int or None, optional) – The height and width of the figure in pixels.
width (int or None, optional) – The height and width of the figure in pixels.
grid (bool or None, optional) – Whether to show the grid on the plot.
toolbar_location (str or None, optional) – The location of the toolbar (e.g., ‘above’, ‘below’, ‘left’, ‘right’).
fig (figure or None, optional) – An existing figure object to plot on.
title (str or None, optional) – The title of the plot.
xlabel (str or None, optional) – Labels for the x and y axes.
ylabel (str or None, optional) – Labels for the x and y axes.
x_axis_location (str or None, optional) – The location of the x and y axes (e.g., ‘bottom’, ‘top’, ‘left’, ‘right’).
y_axis_location (str or None, optional) – The location of the x and y axes (e.g., ‘bottom’, ‘top’, ‘left’, ‘right’).
line_type (str or None, optional) – The type of line to use (e.g., ‘solid’, ‘dashed’, ‘dotted’).
line_width (float or None, optional) – The width of the lines in the plot.
min_border (int or None, optional) – The minimum border size around the plot.
show_plot (bool or None, optional) – Whether to display the plot immediately after creation.
legend (LegendConfig or dict or None, optional) – Configuration for the plot legend.
feature_config (FeatureConfig or dict or None, optional) – Configuration for additional plot features.
backend (str, default None) – Backend to use instead of the backend specified in the option
plotting.backend
. For pyopenms_viz, options are one of (‘ms_matplotlib’, ‘ms_bokeh’, ‘ms_plotly’) Alternatively, to specify theplotting.backend
for the whole session, setpd.options.plotting.backend
.**kwargs – Additional keyword arguments to be passed to the plotting function.
- Return type:
None
Examples
>>> import pandas as pd >>> >>> data = pd.DataFrame(dict'x': [1, 2, 3], 'y': [4, 5, 6])) >>> data.plot(x='x', y='y', kind='spectrum', backend='pomsvim')