mpl_pan_zoom package#

Module contents#

class MouseButton(value)[source]#

Bases: IntEnum

An enumeration.

BACK = 8#
FORWARD = 9#
LEFT = 1#
MIDDLE = 2#
RIGHT = 3#
class PanManager(fig, button)[source]#

Bases: object

Enable panning a plot with any mouse button.

pan = PanManager(my_figure)
# Let it be disabled and garbage collected
pan = None
Parameters:
buttonint

Determines which button will be used (default right click). Left: 1 Middle: 2 Right: 3

disable()[source]#

Disable the PanManager.

Raises:
RuntimeError

If the PanManager is already disabled.

enable()[source]#

Enable the PanManager. It should not be necessary to call this function unless it’s used after a call to PanManager.disable().

Raises:
RuntimeError

If the PanManager is already enabled.

property enabled: bool#

Status of the PanManager, whether it’s enabled or disabled.

press(event)[source]#
release(event)[source]#
zoom_factory(ax, base_scale=1.1)[source]#

Add ability to zoom with the scroll wheel.

Parameters:
axmatplotlib axes object

axis on which to implement scroll to zoom

base_scalefloat

how much zoom on each tick of scroll wheel

Returns:
disconnect_zoomfunction

call this to disconnect the scroll listener