API Reference
This page contains the API reference for PlotEZ.
Main Plotting Functions
PlotEZ - Mundane plotting made easy.
This module provides simplified plotting functions for common visualization tasks.
- plotez.plotez.n_plotter(x_data, y_data, n_rows, n_cols, x_labels=None, y_labels=None, data_labels=None, plot_title=None, subplot_titles=None, is_scatter=False, plot_config=None, figure_kwargs=None)[source]
Plot multiple subplots in a grid with optional customization for each subplot.
- Parameters:
x_data (ArrayLike | list[ArrayLike]) – List of x-axis data arrays for each subplot.
y_data (ArrayLike | list[ArrayLike]) – List of y-axis data arrays for each subplot.
n_rows (int) – Number of rows in the subplot grid.
n_cols (int) – Number of columns in the subplot grid.
x_labels (list[str] | None) – List of labels for the x-axes of each subplot.
y_labels (list[str] | None) – List of labels for the y-axes of each subplot.
data_labels (list[str] | None) – List of labels for the data series in each subplot.
plot_title (str | None) – Title of the plot.
subplot_titles (list[str] | None) – Titles for the individual subplots, if required.
is_scatter (bool) – If True, plots data as scatter plots; otherwise, plots as line plots.
plot_config (LinePlotConfig | ScatterPlotConfig | None) – Configuration object for line or scatter styling. If None, a default
LinePlotConfigis used.figure_kwargs (dict | None) – Keyword arguments for creating the figure and axes. Passed directly to
plt.subplots.
- Returns:
A shaped
(n_rows, n_cols)array of MatplotlibAxesobjects.- Return type:
NDArray
- plotez.plotez.plot_density(x_data, x_label='X', y_label='Density', plot_title='Density Plot', data_label=None, hist_config=None, axis=None, figure_kwargs=None)[source]
Plot a density histogram based on the given data and configuration.
- Parameters:
x_data (ArrayLike) – The data array used for generating the density plot.
x_label (str) – The label for the x-axis. Default is “X”.
y_label (str) – The label for the y-axis. Default is “Density”.
plot_title (str) – The title of the density plot. Default is “Density Plot”.
data_label (str | None) – The optional label for the dataset being visualized. Default is None.
hist_config (HistogramConfig | dict | None) – The histogram configuration, either as an instance of HistogramConfig, a dictionary, or None. If provided, it is used to configure the histogram and ensures that density=True is set. Default is None.
axis (Axes | None) – The Matplotlib Axes object on which to draw the plot. If None, a new set of axes is created. Default is None.
figure_kwargs (dict | None) – Optional keyword arguments passed when creating a new Matplotlib figure. These arguments are ignored if an existing axis is provided. Default is None.
- Returns:
The Matplotlib Axes on which the density plot was drawn.
- Return type:
Axes
- plotez.plotez.plot_errorband(x_data, y_data, y_lower=None, y_upper=None, x_label='X', y_label='Y', plot_title='XY ErrorBand', data_label='X vs. Y', line=True, band_config=None, line_config=None, axis=None, figure_kwargs=None)[source]
Plot a line graph with a shaded error band representing uncertainty.
- Parameters:
x_data (ArrayLike) – The independent variable values to plot.
y_data (ArrayLike) – The central values to plot.
y_lower (int | float | ArrayLike | None) – The lower bound of the error band. If
None, it is inferred as a symmetric reflection ofy_upperthroughy_data. At least one ofy_lowerory_uppermust be provided.y_upper (int | float | ArrayLike | None) – The upper bound of the error band. If
None, it is inferred as a symmetric reflection ofy_lowerthroughy_data. At least one ofy_lowerory_uppermust be provided.x_label (str) – The label for the x-axis.
y_label (str) – The label for the y-axis.
plot_title (str) – The title of the plot.
data_label (str) – The label for the data series, used in the legend. If
line=True, the label is attached to the line. Ifline=False, it is attached to the band.line (bool) – Whether to draw a line through the central values over the error band.
band_config (ErrorBandConfig | None) – Configuration for the error band styling. If
None, defaults are used.line_config (LinePlotConfig | dict | None) – Configuration for the line styling. If
None, defaults are used.axis (Axes | None) – Pre-existing Matplotlib axes to draw on. If provided,
figure_kwargsis ignored.figure_kwargs (dict | None) – Keyword arguments passed to
plt.subplotswhen creating a new figure. Ignored ifaxisis provided.
- Returns:
The Matplotlib Axes on which the plot was drawn.
- Return type:
Axes- Raises:
ConfigurationError – If both
y_lowerandy_upperareNone.
- plotez.plotez.plot_errorband_relative(x_data, y_data, y_lower=None, y_upper=None, x_label='X', y_label='Y', plot_title='XY ErrorBand', data_label='X vs. Y', line=True, band_config=None, line_config=None, axis=None, figure_kwargs=None)[source]
Plot a line graph with a shaded error band using relative (offset) errors.
A convenience wrapper around
plot_errorband()wherey_lowerandy_upperare interpreted as offsets fromy_datarather than absolute bounds. Internally, the absolute bounds are computed asy_data - y_lowerandy_data + y_upperbefore passing toplot_errorband().- Parameters:
x_data (ArrayLike) – The independent variable values to plot.
y_data (ArrayLike) – The central values to plot.
y_lower (int | float | ArrayLike | None) – The downward offset from
y_datadefining the lower band edge. IfNone, it is inferred as equal toy_upper, implying a symmetric band. At least one ofy_lowerory_uppermust be provided.y_upper (int | float | ArrayLike | None) – The upward offset from
y_datadefining the upper band edge. IfNone, it is inferred as equal toy_lower, implying a symmetric band. At least one ofy_lowerory_uppermust be provided.x_label (str) – The label for the x-axis.
y_label (str) – The label for the y-axis.
plot_title (str) – The title of the plot.
data_label (str) – The label for the data series, used in the legend. If
line=True, the label is attached to the line. Ifline=False, it is attached to the band.line (bool) – Whether to draw a line through the central values over the error band.
band_config (ErrorBandConfig | None) – Configuration for the error band styling. If
None, defaults are used.line_config (LinePlotConfig | dict | None) – Configuration for the line styling. If
None, defaults are used.axis (Axes | None) – Pre-existing Matplotlib axes to draw on. If provided,
figure_kwargsis ignored.figure_kwargs (dict | None) – Keyword arguments passed to
plt.subplotswhen creating a new figure. Ignored ifaxisis provided.
- Returns:
The Matplotlib Axes on which the plot was drawn.
- Return type:
Axes- Raises:
ConfigurationError – If both
y_lowerandy_upperareNone.
See also
plot_errorbandThe absolute-bounds version of this function.
- plotez.plotez.plot_errorbar(x_data, y_data, x_err=None, y_err=None, x_label='X', y_label='Y', plot_title='XY ErrorBar', data_label='X vs. Y', errorbar_config=None, axis=None, figure_kwargs=None)[source]
Plot an error bar graph with optional error ranges, labels, and configurations.
- Parameters:
x_data (ArrayLike) – The x-coordinates of the data points.
y_data (ArrayLike) – The y-coordinates of the data points.
x_err (int | float | ArrayLike | None) – Error margins for x-coordinates. Can be: - Scalar: symmetric error for all points - 1D array (N,): symmetric errors, one per point - 2D array (2, N): asymmetric [lower_errors, upper_errors]
y_err (int | float | ArrayLike | None) – Error margins for y-coordinates. Can be: - Scalar: symmetric error for all points - 1D array (N,): symmetric errors, one per point - 2D array (2, N): asymmetric [lower_errors, upper_errors]
x_label (str) – The label for the x-axis.
y_label (str) – The label for the y-axis.
plot_title (str) – The title of the plot.
data_label (str) – The label for the data points, which will appear in the plot legend. If None, the legend is not displayed.
errorbar_config (ErrorPlotConfig | None) – Custom configurations for the error bars. If None, default configurations are used.
figure_kwargs (dict | None) – Keyword arguments for creating the figure and axis when axis is not provided. Ignored if axis is provided.
axis (Axes | None) – A matplotlib Axes object on which the plot will be rendered. If None, a new subplot is created using
figure_kwargs.
- Returns:
The Matplotlib Axes on which the plot was drawn.
- Return type:
Axes
- plotez.plotez.plot_hist(x_data, x_label='X', y_label='Counts', plot_title='Histogram', data_label=None, hist_config=None, axis=None, figure_kwargs=None)[source]
Plot a histogram of the data.
- Parameters:
x_data (ArrayLike) – Array or sequence of data points to be histogrammed.
x_label (str) – Label for the x-axis.
y_label (str) – Label for the y-axis.
plot_title (str) – Title for the plot.
data_label (str | None) – Label(s) for the data series. This is used in plot’s legend generation.
hist_config (HistogramConfig | dict | None) – Configuration object for histogram styling. If None, default configurations are used.
axis (Axes | None) – An existing matplotlib axis object on which to plot. If None, a new figure and axis are created.
figure_kwargs (dict | None) – Keyword arguments for creating the figure and axis when axis is not provided. Ignored if axis is provided.
- Returns:
The Matplotlib Axes on which the histogram was drawn.
- Return type:
Axes
- plotez.plotez.plot_two_column_file(file_name, delimiter=',', skip_header=False, x_label='X', y_label='Y', data_label='XY Data', plot_title='XY Plot', is_scatter=False, plot_config=None, figure_kwargs=None, axis=None)[source]
Read a two-column file (x, y) and plot the data.
- Parameters:
file_name (str) – The path to the file to be plotted. The file should contain two columns (x and y data).
delimiter (str) – The delimiter used in the file (default is ‘,’).
skip_header (bool) – If True, skips the first row in the given data file, otherwise does nothing. Default is False.
x_label (str) – The label for the x-axis.
y_label (str) – The label for the y-axis.
data_label (str) – Data label for the plot to put in the legend. Defaults to ‘X vs Y’.
plot_title (str) – The title for the plot.
is_scatter (bool) – If True, creates a scatter plot. Otherwise, creates a line plot. Default is False.
plot_config (LinePlotConfig | ScatterPlotConfig | None) – Configuration object for line or scatter styling. If None, a default
LinePlotConfigis used.figure_kwargs (dict | None) – Keyword arguments for creating the figure and axis when axis is not provided. Ignored if axis is provided.
axis (Axes | None) – The axis object to draw the plots on. If not passed, a new axis object will be created internally.
- Returns:
The axes object of the plot.
- Return type:
Axes- Raises:
ColumnCountError – If the file does not contain exactly two columns.
- plotez.plotez.plot_with_dual_axes(x1_data, y1_data, x2_data=None, y2_data=None, x1y1_label='X$_1$ vs. Y$_1$', x1y2_label='X$_1$ vs. Y$_2$', x2y1_label='X$_2$ vs. Y$_1$', use_twin_x=False, axis_labels=None, plot_title='DualAxesPlot', is_scatter=False, plot_config=None, figure_kwargs=None, axis=None)[source]
Plot the data with options for dual axes (x or y) or single axis.
- Parameters:
x1_data (ArrayLike) – Data for the primary x-axis.
y1_data (ArrayLike) – Data for the primary y-axis.
x2_data (ArrayLike | None) – Data for the secondary x-axis (used for dual x-axis plots).
y2_data (ArrayLike | None) – Data for the secondary y-axis (used for dual y-axis plots).
x1y1_label (str) – Label for the plot of X1 vs. Y1.
x1y2_label (str) – Label for the plot of X1 vs. Y2 (when using dual Y-axes).
x2y1_label (str) – Label for the plot of X2 vs. Y1 (when using dual X-axes).
use_twin_x (bool) – If True, creates a dual y-axis plot. If False, creates a dual x-axis plot. Default is False.
axis_labels (list[str] | tuple[str, ...] | None) – List of axis labels in the form
[x_label, y_label1, y_label2]. Defaults to["X", r"Y$_1$", r"Y$_2$"]when not provided. Passing a mutablelistis deprecated; use atupleinstead.plot_title (str) – Title of the plot.
is_scatter (bool) – If True, creates scatter plot; otherwise, line plot. Default is False.
plot_config (LinePlotConfig | ScatterPlotConfig | None) – Configuration object for line or scatter styling. If None, a default
LinePlotConfigis used.figure_kwargs (dict | None) – Keyword arguments for creating the figure and axis when axis is not provided. Ignored if axis is provided.
axis (Axes | None) – The axis object to draw the plots on. If not passed, a new axis object will be created internally.
- Returns:
A tuple of
(primary_axis, secondary_axis)when dual axes are used, otherwise a singleAxes.- Return type:
tuple[Axes,Axes]orAxes
- plotez.plotez.plot_xxy(x1_data, x2_data, y_data, y_label='Y', x1_label='X$_1$', x2_label='X$_2$', data_labels=None, plot_title='', is_scatter=False, plot_config=None, figure_kwargs=None, axis=None)[source]
Plot two sets of x-data (x1_data and x2_data) against the same y-data (y_data) on the same plot.
- Parameters:
x1_data (ArrayLike) – The first set of x-axis data to be plotted against y_data.
x2_data (ArrayLike) – The second set of x-axis data to be plotted against y_data.
y_data (ArrayLike) – The y-axis data for both plots.
x1_label (str) – The label for the first x-axis.
x2_label (str) – The label for the second x-axis.
y_label (str) – The label for the y-axis.
plot_title (str) – The title for the plot.
data_labels (list[str] | tuple[str, ...] | None) – The labels for the two datasets. Default is
(r"Y vs. X$_1$", r"Y vs. X$_2$"). Passing a mutablelistis deprecated; use atupleinstead.is_scatter (bool) – Whether to create a scatter plot (True) or a line plot (False). Default is False.
plot_config (LinePlotConfig | ScatterPlotConfig | None) – Configuration object for line or scatter styling. If None, a default
LinePlotConfigis used.figure_kwargs (dict | None) – Keyword arguments for creating the figure and axis when axis is not provided. Ignored if axis is provided.
axis (Axes | None) – A Matplotlib axis to plot on. If None, a new axis is created. Default is None.
- Returns:
A tuple of
(primary_axis, secondary_axis)for the dual x-axis plot.- Return type:
tuple[Axes,Axes]
- plotez.plotez.plot_xy(x_data, y_data, x_label='X', y_label='Y', data_label='XY Data', plot_title='XY Plot', is_scatter=False, plot_config=None, figure_kwargs=None, axis=None)[source]
Plot the x_data against y_data with customizable options.
- Parameters:
x_data (ArrayLike) – The data for the x-axis.
y_data (ArrayLike) – The data for the y-axis.
x_label (str) – The label for the x-axis.
y_label (str) – The label for the y-axis.
plot_title (str) – The title for the plot.
data_label (str) – Data label for the plot to put in the legend.
is_scatter (bool) – If True, creates a scatter plot. Otherwise, creates a line plot. Default is False.
plot_config (LinePlotConfig | ScatterPlotConfig | None) – Configuration object for line or scatter styling. If None, a default
LinePlotConfigis used.figure_kwargs (dict | None) – Keyword arguments for creating the figure and axis when axis is not provided. Ignored if axis is provided.
axis (Axes | None) – The axis object to draw the plots on. If not passed, a new axis object will be created internally.
- Returns:
The axes object of the plot.
- Return type:
Axes
- plotez.plotez.plot_xyy(x_data, y1_data, y2_data, x_label='X', y1_label='Y$_1$', y2_label='Y$_2$', data_labels=None, plot_title='XYY Plot', is_scatter=False, plot_config=None, figure_kwargs=None, axis=None)[source]
Plot two sets of y-data (y1_data and y2_data) against the same x-data (x_data) on the same plot.
- Parameters:
x_data (ArrayLike) – The x-axis data for both plots.
y1_data (ArrayLike) – The first set of y-axis data to be plotted against x_data.
y2_data (ArrayLike) – The second set of y-axis data to be plotted against x_data.
x_label (str) – The label for the x-axis.
y1_label (str) – The label for the first y-axis.
y2_label (str) – The label for the second y-axis.
plot_title (str) – The title for the plot.
data_labels (list[str] | tuple[str, ...] | None) – The labels for the two datasets. Default is
(r"X vs. Y$_1$", r"X vs. Y$_2$"). Passing a mutablelistis deprecated; use atupleinstead.is_scatter (bool) – Whether to create a scatter plot (True) or a line plot (False). Default is False.
plot_config (LinePlotConfig | ScatterPlotConfig | None) – Configuration object for line or scatter styling. If None, a default
LinePlotConfigis used.figure_kwargs (dict | None) – Keyword arguments for creating the figure and axis when axis is not provided. Ignored if axis is provided.
axis (Axes | None) – A Matplotlib axis to plot on. If None, a new axis is created. Default is None.
- Returns:
A tuple of
(primary_axis, secondary_axis)for the dual y-axis plot.- Return type:
tuple[Axes,Axes]
- plotez.plotez.two_subplots(x_data, y_data, x_labels=None, y_labels=None, data_labels=None, plot_title='TwoSubPlots', subplot_titles=None, orientation='h', is_scatter=False, plot_config=None, figure_kwargs=None)[source]
Create two subplots arranged horizontally or vertically, with optional customization.
- Parameters:
x_data (ArrayLike | list[ArrayLike]) – List containing x-axis data arrays for each subplot.
y_data (ArrayLike | list[ArrayLike]) – List containing y-axis data arrays for each subplot.
x_labels (list[str] | tuple[str, ...] | None) – List of labels for the x-axes in each subplot. Defaults to
[r"X$_1$", r"X$_2$"]. Passing a mutablelistis deprecated; use atupleinstead.y_labels (list[str] | tuple[str, ...] | None) – List of labels for the y-axes in each subplot. Defaults to
[r"Y$_1$", r"Y$_2$"]. Passing a mutablelistis deprecated; use atupleinstead.data_labels (list[str] | tuple[str, ...] | None) – List of labels for the data series in each subplot. Defaults to
[r"X$_1$ vs. Y$_1$", r"X$_2$ vs. Y$_2$"]. Passing a mutablelistis deprecated; use atupleinstead.plot_title (str) – Title of the plot.
subplot_titles (list[str] | tuple[str, ...] | None) – Titles for the individual subplots, if required. Passing a mutable
listis deprecated; use atupleinstead.orientation (str) – Orientation of the subplots, either
'h'for horizontal or'v'for vertical.is_scatter (bool) – If True, plots data as scatter plots; otherwise, plots as line plots.
plot_config (LinePlotConfig | ScatterPlotConfig | None) – Configuration object for line or scatter styling. If None, a default
LinePlotConfigis used.figure_kwargs (dict | None) – Keyword arguments for creating the figure and axes. Passed directly to
plt.subplots.
- Returns:
A shaped
(n_rows, n_cols)array of MatplotlibAxesobjects.- Return type:
NDArray- Raises:
OrientationError – If
orientationis not'h'or'v'.
Utility Classes
Parameter Classes
- class plotez.backend.utilities.LinePlotConfig(color=None, linewidth=None, linestyle=None, alpha=None, marker=None, markersize=None, markerfacecolor=None, markeredgecolor=None, markeredgewidth=None, _extra=<factory>)[source]
Bases:
objectConfiguration class for line plots.
- Parameters:
- class plotez.backend.utilities.ErrorPlotConfig(color=None, linewidth=None, linestyle=None, alpha=None, ecolor=None, elinewidth=None, marker=None, markersize=None, markerfacecolor=None, markeredgecolor=None, capsize=None, capthick=None, errorevery=None, _extra=<factory>)[source]
Bases:
objectConfiguration class for error bar plots.
- Parameters:
- class plotez.backend.utilities.ErrorBandConfig(color=None, alpha=0.25, linewidth=None, edgecolor=None, linestyle=None, hatch=None, interpolate=None, step=None, _extra=<factory>)[source]
Bases:
objectConfiguration class for error bands (shaded fill regions).
- Parameters:
- classmethod populate(dictionary)[source]
Create an ErrorBandConfig instance from a dictionary, using a mapping for shorthand keys.
- Parameters:
- Return type:
- class plotez.backend.utilities.ScatterPlotConfig(color=None, s=None, alpha=None, marker=None, cmap=None, edgecolors=None, facecolors=None, _extra=<factory>)[source]
Bases:
objectConfiguration class for scatter plots.
- Parameters:
- class plotez.backend.utilities.HistogramConfig(bins=None, density=None, histtype=None, color=None, alpha=None, edgecolor=None, facecolor=None, linewidth=None, orientation=None, cumulative=None, hatch=None, _extra=<factory>)[source]
Bases:
objectConfiguration class for histogram plots.
- Parameters:
Utility Functions
- plotez.backend.utilities.plot_or_scatter(axes, scatter)[source]
Return the plot or scatter method based on the specified plot type.
- Parameters:
axes – The matplotlib axis on which to apply the plot or scatter method.
scatter (bool) – If True, returns the scatter method; otherwise, returns the plot method.
- Returns:
The matplotlib plotting method (axes.scatter if scatter is True, otherwise axes.plot).
- Return type:
function
- plotez.backend.utilities.split_dictionary(plot_instance)[source]
Split a config instance’s parameters into two separate instances.
- Parameters:
plot_instance (LSE) – An instance with parameters stored as lists or tuples. Each parameter should be a list or tuple containing exactly two values, corresponding to settings for the two resulting instances.
- Returns:
Two instances of the same type as plot_instance, with parameters split based on the values in plot_instance. The first instance (instance1) and second instance (instance2) will have their attributes set according to the first and second elements, respectively, from each list or tuple in plot_instance.
- Return type:
Tuple- Raises:
ValueError – If any parameter in plot_instance is not a list or tuple with exactly two elements.
Notes
The parameters with only one element are broadcast to both instances rather than raising an error.
- plotez.backend.utilities.dual_axes_data_validation(x1_data, x2_data, y1_data, y2_data, use_twin_x, axis_labels)[source]
Validate the data and parameters for dual-axes plotting.
- Parameters:
x1_data (ArrayLike) – Data for the primary x-axis.
x2_data (ArrayLike | None) – Data for the secondary x-axis (used in dual x-axis plots). Should be None if use_twin_x is True.
y1_data (ArrayLike) – Data for the primary y-axis.
y2_data (ArrayLike | None) – Data for the secondary y-axis (used in dual y-axis plots). Should be None if use_twin_x is False.
use_twin_x (bool) – If True, a dual y-axis plot is expected; otherwise, a dual x-axis plot is expected.
axis_labels (list[str | None]) – List of axis labels. Must have exactly three elements: - Label for the x-axis of the primary plot. - Label for the y-axis of the primary plot. - Label for the secondary axis (x or y).
- Raises:
AxisLabelError – If
axis_labelsdoes not have exactly three elements.EmptyDataError – If
x1_dataory1_datais empty.TwinXDataError – If
x2_datais provided whenuse_twin_xisTrue.TwinYDataError – If
y2_datais provided whenuse_twin_xisFalse.
- Return type:
tuple[NDArray, NDArray, NDArray | None, NDArray | None]
Convenience / Wrapper Functions
These factory functions provide a concise, keyword-driven way to build config objects without
importing the dataclass names directly. All are available at the top-level plotez namespace.
Each function also has a short alias that can be used interchangeably:
Long-form function |
Short alias |
|---|---|
|
|
|
|
|
|
|
|
|
|
- plotez.backend._wrappers.line_plot_configuration(c=None, lw=None, ls=None, alpha=None, marker=None, ms=None, mfc=None, mec=None, mew=None, **kwargs)[source]
Create a configuration object for line plots.
- Parameters:
ls (str | list[str] | None) – Line style (e.g., ‘-’, ‘–’, ‘-.’, ‘:’).
alpha (int | float | list[int | float] | None) – Transparency level (0.0 to 1.0).
marker (str | list[str] | None) – Marker style (e.g., ‘o’, ‘s’, ‘^’).
mew (int | float | list[int | float] | None) – Marker-edge width.
**kwargs – Additional keyword arguments passed to the underlying plot function.
- Returns:
Configuration object for line plots.
- Return type:
LinePlotConfig
- plotez.backend._wrappers.error_plot_configuration(c=None, lw=None, ls=None, alpha=None, ecolor=None, elinewidth=None, marker=None, ms=None, mfc=None, mec=None, capsize=None, capthick=None, errorevery=None, **kwargs)[source]
Create a configuration object for error bar plots.
- Parameters:
c (str | None) – Line color.
ls (str | None) – Line style (e.g., ‘-’, ‘–’, ‘-.’, ‘:’).
alpha (int | float | None) – Transparency level (0.0 to 1.0).
ecolor (str | None) – Error bar color.
marker (str | None) – Marker style (e.g., ‘o’, ‘s’, ‘^’).
mfc (str | None) – Marker face color.
mec (str | None) – Marker edge color.
capsize (int | float | None) – Length of the error bar caps in points.
capthick (int | float | None) – Thickness of error bar caps.
errorevery (int | tuple | None) – Draw error bars on a subset of data points.
**kwargs – Additional keyword arguments passed to the underlying errorbar function.
- Returns:
Configuration object for error bar plots.
- Return type:
ErrorPlotConfig
- plotez.backend._wrappers.error_band_configuration(c=None, alpha=0.25, lw=None, ec=None, ls=None, hatch=None, interpolate=None, step=None, **kwargs)[source]
Create a configuration object for error bands.
- Parameters:
c (str | None) – Fill color for the error band.
ec (str | None) – Edge color.
ls (str | None) – Edge line style (e.g., ‘-’, ‘–’, ‘-.’, ‘:’).
hatch (Literal['/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*'] | list[~typing.Literal['/', '\\', '|', '-', '+', 'x', 'o', 'O', '.', '*']] | None) – Hatching pattern (e.g., ‘/’, ‘|’, ‘-’, ‘+’, ‘x’).
interpolate (bool | None) – Whether to interpolate the error band.
step (str | Literal['pre', 'post', 'mid'] | None) – Step mode for the band (e.g., ‘pre’, ‘post’, ‘mid’).
**kwargs – Additional keyword arguments passed to the underlying fill function.
- Returns:
Configuration object for error bands.
- Return type:
ErrorBandConfig
- plotez.backend._wrappers.scatter_plot_configuration(c=None, s=None, alpha=None, marker=None, cmap=None, ec=None, fc=None, **kwargs)[source]
Create a configuration object for scatter plots.
- Parameters:
s (int | float | list[int | float] | None) – Marker size(s) in points squared.
alpha (int | float | list[int | float] | None) – Transparency level (0.0 to 1.0).
marker (str | list[str] | None) – Marker style (e.g., ‘o’, ‘s’, ‘^’).
**kwargs – Additional keyword arguments passed to the underlying scatter function.
- Returns:
Configuration object for scatter plots.
- Return type:
ScatterPlotConfig
- plotez.backend._wrappers.histogram_config(bins=None, density=None, histtype=None, color=None, alpha=None, edgecolor=None, facecolor=None, linewidth=None, orientation=None, cumulative=None, hatch=None, **kwargs)[source]
Create a HistogramConfig instance with the given parameters.
Shorthand Key Reference
All populate() class methods and wrapper functions accept shorthand aliases in place of full
matplotlib parameter names. The tables below list every recognised alias.
Line / Error-bar parameters
Alias |
Full parameter name |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Error-bar-only parameters
The ErrorPlotConfig / epc wrapper also accepts all line aliases above, plus:
Alias |
Full parameter name |
|---|---|
|
|
|
|
|
|
|
|
Scatter parameters
Alias |
Full parameter name |
|---|---|
|
|
|
|
|
|
|
|
Error band parameters
The ErrorBandConfig / ebc wrapper accepts the following shorthand aliases:
Alias |
Full parameter name |
|---|---|
|
|
|
|
|
|
|
|
hatch, interpolate, and step are passed through under their own names.
Histogram parameters
The HistogramConfig / hgc wrapper accepts the following shorthand aliases
(via populate() and the hgc factory function):
Alias |
Full parameter name |
|---|---|
|
|
|
|
|
|
bins, density, histtype, alpha, facecolor, orientation,
cumulative, and hatch are passed through under their own names.
Error Handling
PlotEZ Error Handling.
Custom exceptions for plotting operations.
- exception plotez.backend.error_handling.AxisLabelError[source]
Bases:
ConfigurationErrorRaised when the
axis_labelssequence does not contain exactly three elements.Notes
Dual-axes functions require labels for three axes: primary x, primary y, and the secondary axis (either x or y).
- exception plotez.backend.error_handling.ColumnCountError[source]
Bases:
DataErrorRaised when a data file does not contain exactly two columns.
Notes
plot_two_column_fileexpects files with exactly one x-column and one y-column. Any other column count triggers this error.
- exception plotez.backend.error_handling.ConfigurationError[source]
Bases:
PlotErrorBase class for plot configuration and parameter errors.
Notes
Inherit from this class for errors that arise from incorrect or conflicting plot configuration options rather than from the data itself.
- exception plotez.backend.error_handling.DataError[source]
Bases:
PlotErrorBase class for data-related plotting errors.
Notes
Inherit from this class for any error that stems from invalid, malformed, or incompatible input data arrays or files.
- exception plotez.backend.error_handling.EmptyDataError[source]
Bases:
DataErrorRaised when required primary x or y data is empty.
Notes
At least one data point must be present in the primary x and y arrays before a plot can be constructed.
- exception plotez.backend.error_handling.OrientationError[source]
Bases:
PlotErrorRaised when an invalid or unexpected orientation is used in a plot.
Notes
This error occurs when the orientation parameter for a plot is set incorrectly or does not match the expected format.
- exception plotez.backend.error_handling.PlotError[source]
Bases:
ExceptionBase class for exceptions related to plotting operations.
Notes
This serves as the parent class for all plotting-related errors. Specific exceptions related to plot configuration or data issues should inherit from this class.
- exception plotez.backend.error_handling.ShapeError[source]
Bases:
DataErrorRaised when an array has an unexpected or incompatible shape.
Notes
Typically raised when an error array intended for asymmetric error bars does not satisfy the required
(2, N)shape contract.
- exception plotez.backend.error_handling.TwinXDataError[source]
Bases:
ConfigurationErrorIs raised when
x2_datais supplied for a dual-Y-axis (use_twin_x=True) plot.Notes
A dual-Y-axis plot shares the x-axis between both datasets; providing a separate
x2_datais therefore contradictory and not permitted.
- exception plotez.backend.error_handling.TwinYDataError[source]
Bases:
ConfigurationErrorIs raised when
y2_datais supplied for a dual-X-axis (use_twin_x=False) plot.Notes
A dual-X-axis plot shares the y-axis between both datasets; providing a separate
y2_datais therefore contradictory and not permitted.
Type Aliases
Note
AxesFigReturn is deprecated as of v0.3.2 and kept only as a backward-compatible alias
for AxesReturn. It will be removed in a future release. Use AxesReturn
(Axes | tuple[Axes, Axes] | NDArray) for all new code.
Type aliases used throughout PlotEZ.
Name |
Description |
|---|---|
|
Re-export of |
|
|