matplotlib.backend_managers.ToolManager
-
class matplotlib.backend_tools.AxisScaleBase(*args, **kwargs)
Bases: ToolToggleBase
Base Tool to toggle between linear and logarithmic.
-
disable(event=None)
Disable the toggle tool.
trigger call this method when toggled is True.
This can happen in different circumstances.
-
enable(event=None)
Enable the toggle tool.
trigger calls this method when toggled is False.
-
trigger(sender, event, data=None)
Calls enable or disable based on toggled value.
-
class matplotlib.backend_tools.ConfigureSubplotsBase(toolmanager, name)
Bases: ToolBase
Base tool for the configuration of subplots.
-
description = 'Configure subplots'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
image = 'mpl-data/images/subplots'
Icon filename.
str | None: Filename of the Toolbar icon; either absolute, or relative to the
directory containing the Python source file where the Tool.image class attribute
is defined (in the latter case, this cannot be defined as an instance attribute).
In either case, the extension is optional; leaving it off lets individual backends
select the icon format they prefer. If None, the name is used as a label in the
toolbar button.
-
class matplotlib.backend_tools.Cursors(*values)
Bases: IntEnum
Backend-independent cursor types.
-
HAND = 2
-
MOVE = 4
-
POINTER = 1
-
RESIZE_HORIZONTAL = 6
-
RESIZE_VERTICAL = 7
-
SELECT_REGION = 3
-
WAIT = 5
-
class matplotlib.backend_tools.RubberbandBase(toolmanager, name)
Bases: ToolBase
Draw and remove a rubberband.
-
draw_rubberband(*data)
Draw rubberband.
This method must get implemented per backend.
-
remove_rubberband()
Remove rubberband.
This method should get implemented per backend.
-
trigger(sender, event, data=None)
Call draw_rubberband or remove_rubberband based on data.
-
class matplotlib.backend_tools.SaveFigureBase(toolmanager, name)
Bases: ToolBase
Base tool for figure saving.
-
property default_keymap
The type of the None singleton.
-
description = 'Save the figure'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
image = 'mpl-data/images/filesave'
Icon filename.
str | None: Filename of the Toolbar icon; either absolute, or relative to the
directory containing the Python source file where the Tool.image class attribute
is defined (in the latter case, this cannot be defined as an instance attribute).
In either case, the extension is optional; leaving it off lets individual backends
select the icon format they prefer. If None, the name is used as a label in the
toolbar button.
-
class matplotlib.backend_tools.ToolBack(toolmanager, name)
Bases: ViewsPositionsBase
Move back up the view limits stack.
-
property default_keymap
The type of the None singleton.
-
description = 'Back to previous view'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
image = 'mpl-data/images/back'
Icon filename.
str | None: Filename of the Toolbar icon; either absolute, or relative to the
directory containing the Python source file where the Tool.image class attribute
is defined (in the latter case, this cannot be defined as an instance attribute).
In either case, the extension is optional; leaving it off lets individual backends
select the icon format they prefer. If None, the name is used as a label in the
toolbar button.
-
class matplotlib.backend_tools.ToolBase(toolmanager, name)
Bases: object
Base tool class.
A base tool, only implements trigger method or no method at all.
The tool is instantiated by matplotlib.backend_managers.ToolManager.
-
property canvas
The canvas of the figure affected by this tool, or None.
-
default_keymap = None
Keymap to associate with this tool.
list[str]: List of keys that will trigger this tool when a keypress
event is emitted on self.figure.canvas. Note that this attribute is
looked up on the instance, and can therefore be a property (this is used
e.g. by the built-in tools to load the rcParams at instantiation time).
-
description = None
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
property figure
The Figure affected by this tool, or None.
-
image = None
Icon filename.
str | None: Filename of the Toolbar icon; either absolute, or relative to the
directory containing the Python source file where the Tool.image class attribute
is defined (in the latter case, this cannot be defined as an instance attribute).
In either case, the extension is optional; leaving it off lets individual backends
select the icon format they prefer. If None, the name is used as a label in the
toolbar button.
-
property name
The tool id (str, must be unique among tools of a tool manager).
-
set_figure(figure)
-
property toolmanager
The ToolManager that controls this tool.
-
trigger(sender, event, data=None)
Called when this tool gets used.
This method is called by ToolManager.trigger_tool.
- Parameters:
- event :
-
class matplotlib.backend_tools.ToolCopyToClipboardBase(toolmanager, name)
Bases: ToolBase
Tool to copy the figure to the clipboard.
-
property default_keymap
The type of the None singleton.
-
description = 'Copy the canvas figure to clipboard'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
trigger(*args, **kwargs)
Called when this tool gets used.
This method is called by ToolManager.trigger_tool.
- Parameters:
- event :
Event The canvas event that caused this tool to be called.
-
class matplotlib.backend_tools.ToolForward(toolmanager, name)
Bases: ViewsPositionsBase
Move forward in the view lim stack.
-
property default_keymap
The type of the None singleton.
-
description = 'Forward to next view'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
image = 'mpl-data/images/forward'
Icon filename.
str | None: Filename of the Toolbar icon; either absolute, or relative to the
directory containing the Python source file where the Tool.image class attribute
is defined (in the latter case, this cannot be defined as an instance attribute).
In either case, the extension is optional; leaving it off lets individual backends
select the icon format they prefer. If None, the name is used as a label in the
toolbar button.
-
class matplotlib.backend_tools.ToolFullScreen(toolmanager, name)
Bases: ToolBase
Tool to toggle full screen.
-
property default_keymap
The type of the None singleton.
-
description = 'Toggle fullscreen mode'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
trigger(sender, event, data=None)
Called when this tool gets used.
This method is called by ToolManager.trigger_tool.
- Parameters:
- event :
Event
-
class matplotlib.backend_tools.ToolGrid(toolmanager, name)
Bases: ToolBase
Tool to toggle the major grids of the figure.
-
property default_keymap
The type of the None singleton.
-
description = 'Toggle major grids'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
trigger(sender, event, data=None)
Called when this tool gets used.
This method is called by ToolManager.trigger_tool.
- Parameters:
- event :
Event
-
class matplotlib.backend_tools.ToolHelpBase(toolmanager, name)
Bases: ToolBase
-
property default_keymap
The type of the None singleton.
-
description = 'Print tool list, shortcuts and description'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
static format_shortcut(key_sequence)
Convert a shortcut string from the notation used in rc config to the
standard notation for displaying shortcuts, e.g. 'ctrl+a' -> 'Ctrl+A'.
-
image = 'mpl-data/images/help'
Icon filename.
str | None: Filename of the Toolbar icon; either absolute, or relative to the
directory containing the Python source file where the Tool.image class attribute
is defined (in the latter case, this cannot be defined as an instance attribute).
In either case, the extension is optional; leaving it off lets individual backends
select the icon format they prefer. If None, the name is used as a label in the
toolbar button.
-
class matplotlib.backend_tools.ToolHome(toolmanager, name)
Bases: ViewsPositionsBase
Restore the original view limits.
-
property default_keymap
The type of the None singleton.
-
description = 'Reset original view'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
image = 'mpl-data/images/home'
Icon filename.
str | None: Filename of the Toolbar icon; either absolute, or relative to the
directory containing the Python source file where the Tool.image class attribute
is defined (in the latter case, this cannot be defined as an instance attribute).
In either case, the extension is optional; leaving it off lets individual backends
select the icon format they prefer. If None, the name is used as a label in the
toolbar button.
-
class matplotlib.backend_tools.ToolMinorGrid(toolmanager, name)
Bases: ToolBase
Tool to toggle the major and minor grids of the figure.
-
property default_keymap
The type of the None singleton.
-
description = 'Toggle major and minor grids'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
trigger(sender, event, data=None)
Called when this tool gets used.
This method is called by ToolManager.trigger_tool.
- Parameters:
- event :
Event
-
class matplotlib.backend_tools.ToolPan(*args)
Bases: ZoomPanBase
Pan Axes with left mouse, zoom with right.
-
cursor = 4
Cursor to use when the tool is active.
-
property default_keymap
The type of the None singleton.
-
description = 'Pan axes with left mouse, zoom with right'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
image = 'mpl-data/images/move'
Icon filename.
str | None: Filename of the Toolbar icon; either absolute, or relative to the
directory containing the Python source file where the Tool.image class attribute
is defined (in the latter case, this cannot be defined as an instance attribute).
In either case, the extension is optional; leaving it off lets individual backends
select the icon format they prefer. If None, the name is used as a label in the
toolbar button.
-
radio_group = 'default'
Attribute to group 'radio' like tools (mutually exclusive).
str that identifies the group or None if not belonging to a group.
-
class matplotlib.backend_tools.ToolQuit(toolmanager, name)
Bases: ToolBase
Tool to call the figure manager destroy method.
-
property default_keymap
The type of the None singleton.
-
description = 'Quit the figure'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
trigger(sender, event, data=None)
Called when this tool gets used.
This method is called by ToolManager.trigger_tool.
- Parameters:
- event :
Event
-
class matplotlib.backend_tools.ToolQuitAll(toolmanager, name)
Bases: ToolBase
Tool to call the figure manager destroy method.
-
property default_keymap
The type of the None singleton.
-
description = 'Quit all figures'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
trigger(sender, event, data=None)
Called when this tool gets used.
This method is called by ToolManager.trigger_tool.
- Parameters:
- event :
Event
-
class matplotlib.backend_tools.ToolSetCursor(*args, **kwargs)
Bases: ToolBase
Change to the current cursor while inaxes.
This tool, keeps track of all ToolToggleBase derived tools, and updates
the cursor when a tool gets triggered.
-
set_figure(figure)
-
class matplotlib.backend_tools.ToolToggleBase(*args, **kwargs)
Bases: ToolBase
Toggleable tool.
Every time it is triggered, it switches between enable and disable.
- Parameters:
- ``*args``
Variable length argument to be used by the Tool.
- ``**kwargs``
toggled if present and True, sets the initial state of the Tool
Arbitrary keyword arguments to be consumed by the Tool
-
cursor = None
Cursor to use when the tool is active.
-
default_toggled = False
Default of toggled state.
-
disable(event=None)
Disable the toggle tool.
trigger call this method when toggled is True.
This can happen in different circumstances.
-
enable(event=None)
Enable the toggle tool.
trigger calls this method when toggled is False.
-
radio_group = None
Attribute to group 'radio' like tools (mutually exclusive).
str that identifies the group or None if not belonging to a group.
-
set_figure(figure)
-
property toggled
State of the toggled tool.
-
trigger(sender, event, data=None)
Calls enable or disable based on toggled value.
-
class matplotlib.backend_tools.ToolViewsPositions(*args, **kwargs)
Bases: ToolBase
Auxiliary Tool to handle changes in views and positions.
Runs in the background and should get used by all the tools that
need to access the figure's history of views and positions, e.g.
-
add_figure(figure)
Add the current figure to the stack of views and positions.
-
back()
Back one step in the stack of views and positions.
-
clear(figure)
Reset the Axes stack.
-
forward()
Forward one step in the stack of views and positions.
-
home()
Recall the first view and position from the stack.
-
push_current(figure=None)
Push the current view limits and position onto their respective stacks.
-
update_home_views(figure=None)
Make sure that self.home_views has an entry for all Axes present
in the figure.
-
update_view()
Update the view limits and position for each Axes from the current
stack position. If any Axes are present in the figure that aren't in
the current stack position, use the home view limits for those Axes and
don't update any positions.
-
class matplotlib.backend_tools.ToolXScale(*args, **kwargs)
Bases: AxisScaleBase
Tool to toggle between linear and logarithmic scales on the X axis.
-
property default_keymap
The type of the None singleton.
-
description = 'Toggle scale X axis'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
set_scale(ax, scale)
-
class matplotlib.backend_tools.ToolYScale(*args, **kwargs)
Bases: AxisScaleBase
Tool to toggle between linear and logarithmic scales on the Y axis.
-
property default_keymap
The type of the None singleton.
-
description = 'Toggle scale Y axis'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
set_scale(ax, scale)
-
class matplotlib.backend_tools.ToolZoom(*args)
Bases: ZoomPanBase
A Tool for zooming using a rectangle selector.
-
cursor = 3
Cursor to use when the tool is active.
-
property default_keymap
The type of the None singleton.
-
description = 'Zoom to rectangle'
Description of the Tool.
str: Tooltip used if the Tool is included in a Toolbar.
-
image = 'mpl-data/images/zoom_to_rect'
Icon filename.
str | None: Filename of the Toolbar icon; either absolute, or relative to the
directory containing the Python source file where the Tool.image class attribute
is defined (in the latter case, this cannot be defined as an instance attribute).
In either case, the extension is optional; leaving it off lets individual backends
select the icon format they prefer. If None, the name is used as a label in the
toolbar button.
-
radio_group = 'default'
Attribute to group 'radio' like tools (mutually exclusive).
str that identifies the group or None if not belonging to a group.
-
class matplotlib.backend_tools.ViewsPositionsBase(toolmanager, name)
Bases: ToolBase
Base class for ToolHome, ToolBack and ToolForward.
-
trigger(sender, event, data=None)
Called when this tool gets used.
This method is called by ToolManager.trigger_tool.
- Parameters:
- event :
Event The canvas event that caused this tool to be called.
- sender : object
Object that requested the tool to be triggered.
- data : object
Extra data.
-
class matplotlib.backend_tools.ZoomPanBase(*args)
Bases: ToolToggleBase
Base class for ToolZoom and ToolPan.
-
disable(event=None)
Release the canvas and disconnect press/release events.
-
enable(event=None)
Connect press/release events and lock the canvas.
-
scroll_zoom(event)
-
trigger(sender, event, data=None)
Calls enable or disable based on toggled value.
-
matplotlib.backend_tools.add_tools_to_container(container, tools=None)
Add multiple tools to the container.
- Parameters:
- container : Container
backend_bases.ToolContainerBase object that will get the tools
added.
- tools : list, optional
List in the form [[group1, [tool1, tool2 ...]], [group2, [...]]]
where the tools [tool1, tool2, ...] will display in group1.
See backend_bases.ToolContainerBase.add_tool for details. If not specified,
then defaults to default_toolbar_tools.
-
matplotlib.backend_tools.cursors
alias of Cursors
-
matplotlib.backend_tools.default_toolbar_tools = [['navigation', ['home', 'back', 'forward']], ['zoompan', ['pan', 'zoom', 'subplots']], ['io', ['save', 'help']]]
The default tools to add to a container.
-
matplotlib.backend_tools.default_tools = {'back': <class 'matplotlib.backend_tools.ToolBack'>, 'copy': <class 'matplotlib.backend_tools.ToolCopyToClipboardBase'>, 'cursor': <class 'matplotlib.backend_tools.ToolSetCursor'>, 'forward': <class 'matplotlib.backend_tools.ToolForward'>, 'fullscreen': <class 'matplotlib.backend_tools.ToolFullScreen'>, 'grid': <class 'matplotlib.backend_tools.ToolGrid'>, 'grid_minor': <class 'matplotlib.backend_tools.ToolMinorGrid'>, 'help': <class 'matplotlib.backend_tools.ToolHelpBase'>, 'home': <class 'matplotlib.backend_tools.ToolHome'>, 'pan': <class 'matplotlib.backend_tools.ToolPan'>, 'position': <class 'matplotlib.backend_tools.ToolCursorPosition'>, 'quit': <class 'matplotlib.backend_tools.ToolQuit'>, 'quit_all': <class 'matplotlib.backend_tools.ToolQuitAll'>, 'rubberband': <class 'matplotlib.backend_tools.RubberbandBase'>, 'save': <class 'matplotlib.backend_tools.SaveFigureBase'>, 'subplots': <class 'matplotlib.backend_tools.ConfigureSubplotsBase'>, 'viewpos': <class 'matplotlib.backend_tools.ToolViewsPositions'>, 'xscale': <class 'matplotlib.backend_tools.ToolXScale'>, 'yscale': <class 'matplotlib.backend_tools.ToolYScale'>, 'zoom': <class 'matplotlib.backend_tools.ToolZoom'>}
The default tools to add to a tool manager.
Event
The canvas event that caused this tool to be called.
sender : objectObject that requested the tool to be triggered.
data : objectsender : objectObject that requested the tool to be triggered.
data : objectThe canvas event that caused this tool to be called.
sender : objectObject that requested the tool to be triggered.
data : objectThe canvas event that caused this tool to be called.
sender : objectObject that requested the tool to be triggered.
data : objectThe canvas event that caused this tool to be called.
sender : objectObject that requested the tool to be triggered.
data : objectThe canvas event that caused this tool to be called.
sender : objectObject that requested the tool to be triggered.
data : objectThe canvas event that caused this tool to be called.
sender : objectObject that requested the tool to be triggered.
data : objectToolToggleBase