API Reference¶
Functions¶
Classes¶
-
class
paxplot.
PaxFigure
(*args, data=[], **kwargs)¶ -
add_colorbar
(ax_idx: int, cmap='viridis', colorbar_kwargs={})¶ Add colorbar to paxfigure
- Parameters
ax (int) – axes index
data (array-like) – Data to be plotted
cmap (str) – Matplotlib colormap to use for coloring
colorbar_kwargs (dict) – Matplotlib colorbar keyword arguments
-
add_legend
(labels=[])¶ Create a legend for a specified figure
- Parameters
labels (list) – List of data labels
-
invert_axis
(ax_idx: int)¶ Invert axis
- Parameters
ax_idx (int) – Index of matplotlib axes
-
plot
(data: list, line_kwargs={})¶ Plot the supplied data
- Parameters
data (array-like) – Data to be plotted
line_kwargs (dict) – Keyword arguments for lines corresponding to data
-
savefig
(fname, *, transparent=None, **kwargs)¶ Save the current figure.
Call signature:
savefig(fname, *, dpi='figure', format=None, metadata=None, bbox_inches=None, pad_inches=0.1, facecolor='auto', edgecolor='auto', backend=None, **kwargs )
The available output formats depend on the backend being used.
- Parameters
fname (str or path-like or binary file-like) –
A path, or a Python file-like object, or possibly some backend-dependent object such as matplotlib.backends.backend_pdf.PdfPages.
If format is set, it determines the output format, and the file is saved as fname. Note that fname is used verbatim, and there is no attempt to make the extension, if any, of fname match format, and no extension is appended.
If format is not set, then the format is inferred from the extension of fname, if there is one. If format is not set and fname has no extension, then the file is saved with :rc:`savefig.format` and the appropriate extension is appended to fname.
- Other Parameters
dpi (float or ‘figure’, default: :rc:`savefig.dpi`) – The resolution in dots per inch. If ‘figure’, use the figure’s dpi value.
format (str) – The file format, e.g. ‘png’, ‘pdf’, ‘svg’, … The behavior when this is unset is documented under fname.
metadata (dict, optional) – Key/value pairs to store in the image metadata. The supported keys and defaults depend on the image format and backend:
‘png’ with Agg backend: See the parameter
metadata
of ~.FigureCanvasAgg.print_png.‘pdf’ with pdf backend: See the parameter
metadata
of ~.backend_pdf.PdfPages.‘svg’ with svg backend: See the parameter
metadata
of ~.FigureCanvasSVG.print_svg.‘eps’ and ‘ps’ with PS backend: Only ‘Creator’ is supported.
bbox_inches (str or .Bbox, default: :rc:`savefig.bbox`) – Bounding box in inches: only the given portion of the figure is saved. If ‘tight’, try to figure out the tight bbox of the figure.
pad_inches (float, default: :rc:`savefig.pad_inches`) – Amount of padding around the figure when bbox_inches is ‘tight’.
facecolor (color or ‘auto’, default: :rc:`savefig.facecolor`) – The facecolor of the figure. If ‘auto’, use the current figure facecolor.
edgecolor (color or ‘auto’, default: :rc:`savefig.edgecolor`) – The edgecolor of the figure. If ‘auto’, use the current figure edgecolor.
backend (str, optional) – Use a non-default backend to render the file, e.g. to render a png file with the “cairo” backend rather than the default “agg”, or a pdf file with the “pgf” backend rather than the default “pdf”. Note that the default backend is normally sufficient. See the-builtin-backends for a list of valid backends for each file format. Custom backends can be referenced as “module://…”.
orientation ({‘landscape’, ‘portrait’}) – Currently only supported by the postscript backend.
papertype (str) – One of ‘letter’, ‘legal’, ‘executive’, ‘ledger’, ‘a0’ through ‘a10’, ‘b0’ through ‘b10’. Only supported for postscript output.
transparent (bool) – If True, the Axes patches will all be transparent; the Figure patch will also be transparent unless facecolor and/or edgecolor are specified via kwargs.
If False has no effect and the color of the Axes and Figure patches are unchanged (unless the Figure patch is specified via the facecolor and/or edgecolor keyword arguments in which case those colors are used).
The transparency of these patches will be restored to their original values upon exit of this function.
This is useful, for example, for displaying a plot on top of a colored background on a web page.
bbox_extra_artists (list of ~matplotlib.artist.Artist, optional) – A list of extra artists that will be considered when the tight bbox is calculated.
pil_kwargs (dict, optional) – Additional keyword arguments that are passed to PIL.Image.Image.save when saving the figure.
-
set_even_ticks
(ax_idx: int, n_ticks=6, minimum=None, maximum=None, precision=2)¶ Set evenly spaced axis ticks between minimum and maximum value. If no minimum and maximum values are specified, the limits of the underlying plotted data are assumed.
- Parameters
ax_idx (int) – Index of matplotlib axes
n_ticks (int) – Number of ticks
minimum (numeric) – minimum value for ticks
maximum (numeric) – maximum value for ticks
precision (int) – number of decimal points for tick labels
-
set_label
(ax_idx: int, label: str)¶ Set the label for the axis
- Parameters
ax_idx (int) – Index of matplotlib axes
label (str) – The label text
-
set_labels
(labels: list)¶ Set labels for all axes. A wrapper for set_label
- Parameters
labels (list) – Labels for each axis. Must be same length as number of axes.
-
set_lim
(ax_idx: int, bottom: float, top: float)¶ Set custom limits on axis
- Parameters
ax_idx (int) – Index of matplotlib axes
bottom (numeric) – Lower limit
top (numeric) – Upper limit
-
set_ticks
(ax_idx: int, ticks: list, labels=None)¶ Set the axis tick locations and optionally labels.
- Parameters
ax_idx (int) – Index of matplotlib axes
ticks (list of floats) – List of tick locations.
labels (list of str, optional) – List of tick labels. If not set, the labels show the data value.
-
Contents¶
|
Wrapper for paxplot analagous to the matplotlib.pyplot.subplots function |
|
Plot the supplied data |
|
Set the label for the axis |
|
Set labels for all axes. |
|
Set evenly spaced axis ticks between minimum and maximum value. |
|
Set the axis tick locations and optionally labels. |
|
Set custom limits on axis |
|
Invert axis |
|
Create a legend for a specified figure |
|
Add colorbar to paxfigure |
|
Save the current figure. |