plopp.backends.matplotlib.canvas.Canvas#
- class plopp.backends.matplotlib.canvas.Canvas(ax=None, cax=None, figsize=None, title=None, grid=False, user_vmin=None, user_vmax=None, aspect=None, cbar=False, legend=True, xmin=None, xmax=None, ymin=None, ymax=None, logx=False, logy=False, xlabel=None, ylabel=None, norm=None, **ignored)[source]#
Matplotlib-based canvas used to render 2D graphics. It provides a figure and some axes, as well as functions for controlling the zoom, panning, and the scale of the axes.
- Parameters:
ax (
Axes, default:None) – If supplied, use these axes to create the figure. If none are supplied, the canvas will create its own axes.cax (
Axes, default:None) – If supplied, use these axes for the colorbar. If none are supplied, and a colorbar is required, the canvas will create its own axes.figsize (
tuple[float,float] |None, default:None) – The width and height of the figure, in inches.title (
str|None, default:None) – The title to be placed above the figure.grid (
bool, default:False) – Display the figure grid ifTrue.user_vmin (
Variable|float|None, default:None) – The minimum value for the y axis (1d plots only).user_vmax (
Variable|float|None, default:None) – The maximum value for the y axis (1d plots only).aspect (
Literal['auto','equal',None], default:None) – The aspect ratio for the axes.cbar (
bool, default:False) – Add axes to host a colorbar ifTrue.legend (
bool|tuple[float,float], default:True) – Show legend ifTrue. Iflegendis a tuple, it should contain the(x, y)coordinates of the legend’s anchor point in axes coordinates.xmin (
Variable|float|None, default:None) – The minimum value for the x axis.xmax (
Variable|float|None, default:None) – The maximum value for the x axis.ymin (
Variable|float|None, default:None) – The minimum value for the y axis.ymax (
Variable|float|None, default:None) – The maximum value for the y axis.logx (
bool, default:False) – IfTrue, use a logarithmic scale for the x axis.logy (
bool, default:False) – IfTrue, use a logarithmic scale for the y axis.xlabel (
str|None, default:None) – The label for the x axis.ylabel (
str|None, default:None) – The label for the y axis.norm (
Literal['linear','log',None], default:None) – Set to'log'for a logarithmic y-axis (legacy, preferlogyinstead).
- __init__(ax=None, cax=None, figsize=None, title=None, grid=False, user_vmin=None, user_vmax=None, aspect=None, cbar=False, legend=True, xmin=None, xmax=None, ymin=None, ymax=None, logx=False, logy=False, xlabel=None, ylabel=None, norm=None, **ignored)[source]#
Methods
__init__([ax, cax, figsize, title, grid, ...])download_figure()Save the figure to a PNG file via a pop-up dialog.
draw()Make a draw call to the underlying figure.
format_coord(x, y)Format the coordinates of the mouse pointer to show the value of the data at that point.
has_user_xlabel()Return
Trueif the user has set an x-axis label.has_user_ylabel()Return
Trueif the user has set a y-axis label.is_widget()pan()Activate the underlying Matplotlib pan tool.
panzoom(value)Activate or deactivate the pan or zoom tool, depending on the input value.
register_format_coord(formatter)Register a custom axis formatter for the x-axis.
reset_mode()Reset the Matplotlib toolbar mode to nothing, to disable all Zoom/Pan tools.
save(filename, **kwargs)Save the figure to file.
set_axes(dims, units, dtypes)Set the axes dimensions and units.
to_image()Convert the underlying Matplotlib figure to an image widget from
ipywidgets.to_widget()toggle_logx()Toggle the scale between
linearandlogalong the horizontal axis.toggle_logy()Toggle the scale between
linearandlogalong the vertical axis.update_legend()Update the legend on the canvas.
zoom()Activate the underlying Matplotlib zoom tool.
Attributes
cblabelGet or set the label of the colorbar.
emptyCheck if the canvas is empty.
gridGet or set the visibility of the grid.
logxGet or set whether the x-axis is in logarithmic scale.
logyGet or set whether the y-axis is in logarithmic scale.
titleGet or set the title of the plot.
xlabelGet or set the label of the x-axis.
xmaxGet or set the upper (right) bound of the x-axis.
xminGet or set the lower (left) bound of the x-axis.
xrangeGet or set the range/limits of the x-axis.
xscaleGet or set the scale of the x-axis ('linear' or 'log').
ylabelGet or set the label of the y-axis.
ymaxGet or set the upper (top) bound of the y-axis.
yminGet or set the lower (bottom) bound of the y-axis.
yrangeGet or set the range/limits of the y-axis.
yscaleGet or set the scale of the y-axis ('linear' or 'log').