plopp.backends.plotly.canvas.Canvas#

class plopp.backends.plotly.canvas.Canvas(figsize=None, title=None, vmin=None, vmax=None, autoscale='auto', **ignored)[source]#

Plotly-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:
  • figsize (Optional[Tuple[float, float]], default: None) – The width and height of the figure, in inches.

  • title (Optional[str], default: None) – The title to be placed above the figure.

  • vmin (Union[Variable, int, float, None], default: None) – The minimum value for the vertical axis. If a number (without a unit) is supplied, it is assumed that the unit is the same as the current vertical axis unit.

  • vmax (Union[Variable, int, float, None], default: None) – The maximum value for the vertical axis. If a number (without a unit) is supplied, it is assumed that the unit is the same as the current vertical axis unit.

  • autoscale (Literal['auto', 'grow'], default: 'auto') – The behavior of the axis limits. If auto, the limits automatically adjusts every time the data changes. If grow, the limits are allowed to grow with time but they do not shrink.

__init__(figsize=None, title=None, vmin=None, vmax=None, autoscale='auto', **ignored)[source]#

Methods

__init__([figsize, title, vmin, vmax, autoscale])

autoscale()

Auto-scale the axes ranges to show all data in the canvas.

download_figure()

Save the figure to a PNG file via a pop-up dialog.

finalize()

Finalize is called at the end of figure creation.

logx()

Toggle the scale between linear and log along the horizontal axis.

logy()

Toggle the scale between linear and log along the vertical axis.

pan()

Activate the underlying Plotly pan tool.

panzoom(value)

Activate or deactivate the pan or zoom tool, depending on the input value.

reset_mode()

Reset the modebar mode to nothing, to disable all zoom/pan tools.

save(filename)

Save the figure to file.

set_axes(dims, units, dtypes)

Set the axes dimensions and units.

to_widget()

zoom()

Activate the underlying Plotly zoom tool.

Attributes

empty

Check if the canvas is empty.

title

Get or set the title of the plot.

xlabel

Get or set the label of the x-axis.

xmax

Get or set the upper (right) bound of the x-axis.

xmin

Get or set the lower (left) bound of the x-axis.

xrange

Get or set the range/limits of the x-axis.

xscale

Get or set the scale of the x-axis ('linear' or 'log').

ylabel

Get or set the label of the y-axis.

ymax

Get or set the upper (top) bound of the y-axis.

ymin

Get or set the lower (bottom) bound of the y-axis.

yrange

Get or set the range/limits of the y-axis.

yscale

Get or set the scale of the y-axis ('linear' or 'log').