matplotlib.backend_tools Abstract base classes define the primitives for Tools. These tools are used by matplotlib.backend_managers.ToolManager  ToolBase

Simple stateless tool  ToolToggleBase

Tool that has two states, only one Toggle tool can be active at any given time for the same matplotlib.backend_managers.ToolManager     classmatplotlib.backend_tools.AxisScaleBase(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.ToolToggleBase Base Tool to toggle between linear and logarithmic.   disable(event)[source]

Disable the toggle tool. trigger call this method when toggled is True. This can happen in different circumstances.  Click on the toolbar tool button. Call to matplotlib.backend_managers.ToolManager.trigger_tool. Another ToolToggleBase derived tool is triggered (from the same ToolManager).
   enable(event)[source]

Enable the toggle tool. trigger calls this method when toggled is False.
   trigger(sender, event, data=None)[source]

Calls enable or disable based on toggled value.

   classmatplotlib.backend_tools.ConfigureSubplotsBase(toolmanager, name)[source]

Bases: matplotlib.backend_tools.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='subplots'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.

   classmatplotlib.backend_tools.Cursors(value)[source]

Bases: enum.IntEnum Backend-independent cursor types.   HAND=2[source]

   MOVE=4[source]

   POINTER=1[source]

   RESIZE_HORIZONTAL=6[source]

   RESIZE_VERTICAL=7[source]

   SELECT_REGION=3[source]

   WAIT=5[source]

   classmatplotlib.backend_tools.RubberbandBase(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Draw and remove a rubberband.   draw_rubberband(*data)[source]

Draw rubberband. This method must get implemented per backend.
   remove_rubberband()[source]

Remove rubberband. This method should get implemented per backend.
   trigger(sender, event, data)[source]

Call draw_rubberband or remove_rubberband based on data.

   classmatplotlib.backend_tools.SaveFigureBase(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Base tool for figure saving.   default_keymap=['s', 'ctrl+s']

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.
   description='Save the figure'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   image='filesave'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.

   classmatplotlib.backend_tools.SetCursorBase(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.ToolBase Change to the current cursor while inaxes. This tool, keeps track of all ToolToggleBase derived tools, and calls set_cursor when a tool gets triggered.   set_cursor(cursor)[source]

[Deprecated] Set the cursor. Notes  Deprecated since version 3.5.
   set_figure(figure)[source]

   classmatplotlib.backend_tools.ToolBack(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ViewsPositionsBase Move back up the view limits stack.   default_keymap=['left', 'c', 'backspace', 'MouseButton.BACK']

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.
   description='Back to previous view'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   image='back'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.

   classmatplotlib.backend_tools.ToolBase(toolmanager, name)[source]

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.   propertycanvas

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.
   description=None

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   destroy()[source]

Destroy the tool. This method is called by ToolManager.remove_tool.
   propertyfigure

The Figure affected by this tool, or None.
   image=None

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.
   propertyname

The tool id (str, must be unique among tools of a tool manager).
   set_figure(figure)[source]

   propertytoolmanager

The ToolManager that controls this tool.
   trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.

   matplotlib.backend_tools.ToolCopyToClipboard[source]

alias of matplotlib.backend_tools.ToolCopyToClipboardBase
   classmatplotlib.backend_tools.ToolCopyToClipboardBase(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Tool to copy the figure to the clipboard.   default_keymap=['ctrl+c', 'cmd+c']

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.
   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)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.

   classmatplotlib.backend_tools.ToolCursorPosition(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.ToolBase Send message with the current pointer position. This tool runs in the background reporting the position of the cursor.   send_message(event)[source]

Call matplotlib.backend_managers.ToolManager.message_event.
   set_figure(figure)[source]

   classmatplotlib.backend_tools.ToolForward(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ViewsPositionsBase Move forward in the view lim stack.   default_keymap=['right', 'v', 'MouseButton.FORWARD']

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.
   description='Forward to next view'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   image='forward'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.

   classmatplotlib.backend_tools.ToolFullScreen(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.ToolToggleBase Tool to toggle full screen.   default_keymap=['f', 'ctrl+f']

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.
   description='Toggle fullscreen mode'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   disable(event)[source]

Disable the toggle tool. trigger call this method when toggled is True. This can happen in different circumstances.  Click on the toolbar tool button. Call to matplotlib.backend_managers.ToolManager.trigger_tool. Another ToolToggleBase derived tool is triggered (from the same ToolManager).
   enable(event)[source]

Enable the toggle tool. trigger calls this method when toggled is False.

   classmatplotlib.backend_tools.ToolGrid(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Tool to toggle the major grids of the figure.   default_keymap=['g']

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.
   description='Toggle major grids'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.

   classmatplotlib.backend_tools.ToolHelpBase(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase   default_keymap=['f1']

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.
   description='Print tool list, shortcuts and description'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   staticformat_shortcut(key_sequence)[source]

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='help'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.

   classmatplotlib.backend_tools.ToolHome(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ViewsPositionsBase Restore the original view limits.   default_keymap=['h', 'r', 'home']

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.
   description='Reset original view'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   image='home'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.

   classmatplotlib.backend_tools.ToolMinorGrid(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Tool to toggle the major and minor grids of the figure.   default_keymap=['G']

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.
   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)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.

   classmatplotlib.backend_tools.ToolPan(*args)[source]

Bases: matplotlib.backend_tools.ZoomPanBase Pan axes with left mouse, zoom with right.   cursor=4[source]

Cursor to use when the tool is active.
   default_keymap=['p']

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.
   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='move'

Filename of the image. str: Filename of the image to use in a Toolbar. 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.

   classmatplotlib.backend_tools.ToolQuit(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Tool to call the figure manager destroy method.   default_keymap=['ctrl+w', 'cmd+w', 'q']

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.
   description='Quit the figure'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.

   classmatplotlib.backend_tools.ToolQuitAll(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Tool to call the figure manager destroy method.   default_keymap=[]

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.
   description='Quit all figures'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.

   matplotlib.backend_tools.ToolSetCursor[source]

alias of matplotlib.backend_tools.SetCursorBase
   classmatplotlib.backend_tools.ToolToggleBase(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.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)[source]

Disable the toggle tool. trigger call this method when toggled is True. This can happen in different circumstances.  Click on the toolbar tool button. Call to matplotlib.backend_managers.ToolManager.trigger_tool. Another ToolToggleBase derived tool is triggered (from the same ToolManager).
   enable(event=None)[source]

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)[source]

   propertytoggled

State of the toggled tool.
   trigger(sender, event, data=None)[source]

Calls enable or disable based on toggled value.

   classmatplotlib.backend_tools.ToolViewsPositions(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.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.  ToolZoom ToolPan ToolHome ToolBack ToolForward    add_figure(figure)[source]

Add the current figure to the stack of views and positions.
   back()[source]

Back one step in the stack of views and positions.
   clear(figure)[source]

Reset the axes stack.
   forward()[source]

Forward one step in the stack of views and positions.
   home()[source]

Recall the first view and position from the stack.
   push_current(figure=None)[source]

Push the current view limits and position onto their respective stacks.
   update_home_views(figure=None)[source]

Make sure that self.home_views has an entry for all axes present in the figure.
   update_view()[source]

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.

   classmatplotlib.backend_tools.ToolXScale(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.AxisScaleBase Tool to toggle between linear and logarithmic scales on the X axis.   default_keymap=['k', 'L']

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.
   description='Toggle scale X axis'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   set_scale(ax, scale)[source]

   classmatplotlib.backend_tools.ToolYScale(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.AxisScaleBase Tool to toggle between linear and logarithmic scales on the Y axis.   default_keymap=['l']

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.
   description='Toggle scale Y axis'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   set_scale(ax, scale)[source]

   classmatplotlib.backend_tools.ToolZoom(*args)[source]

Bases: matplotlib.backend_tools.ZoomPanBase A Tool for zooming using a rectangle selector.   cursor=3[source]

Cursor to use when the tool is active.
   default_keymap=['o']

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.
   description='Zoom to rectangle'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   image='zoom_to_rect'

Filename of the image. str: Filename of the image to use in a Toolbar. 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.

   classmatplotlib.backend_tools.ViewsPositionsBase(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Base class for ToolHome, ToolBack and ToolForward.   trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.

   classmatplotlib.backend_tools.ZoomPanBase(*args)[source]

Bases: matplotlib.backend_tools.ToolToggleBase Base class for ToolZoom and ToolPan.   disable(event)[source]

Release the canvas and disconnect press/release events.
   enable(event)[source]

Connect press/release events and lock the canvas.
   scroll_zoom(event)[source]

   trigger(sender, event, data=None)[source]

Calls enable or disable based on toggled value.

   matplotlib.backend_tools.add_tools_to_container(container, tools=[['navigation', ['home', 'back', 'forward']], ['zoompan', ['pan', 'zoom', 'subplots']], ['io', ['save', 'help']]])[source]

Add multiple tools to the container.  Parameters

containerContainer

backend_bases.ToolContainerBase object that will get the tools added.
toolslist, optional

List in the form [[group1, [tool1, tool2 ...]], [group2, [...]]] where the tools [tool1, tool2, ...] will display in group1. See add_tool for details.
   matplotlib.backend_tools.add_tools_to_manager(toolmanager, tools={'back': <class 'matplotlib.backend_tools.ToolBack'>, 'copy': 'ToolCopyToClipboard', 'cursor': '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': 'ToolHelp', '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': 'ToolRubberband', 'save': 'ToolSaveFigure', 'subplots': 'ToolConfigureSubplots', 'viewpos': <class 'matplotlib.backend_tools.ToolViewsPositions'>, 'xscale': <class 'matplotlib.backend_tools.ToolXScale'>, 'yscale': <class 'matplotlib.backend_tools.ToolYScale'>, 'zoom': <class 'matplotlib.backend_tools.ToolZoom'>})[source]

Add multiple tools to a ToolManager.  Parameters

toolmanagerbackend_managers.ToolManager

Manager to which the tools are added.
tools{str: class_like}, optional

The tools to add in a {name: tool} dict, see add_tool for more info.
   matplotlib.backend_tools.cursors[source]

alias of matplotlib.backend_tools.Cursors
   matplotlib.backend_tools.default_toolbar_tools=[['navigation', ['home', 'back', 'forward']], ['zoompan', ['pan', 'zoom', 'subplots']], ['io', ['save', 'help']]]

Default tools in the toolbar
   matplotlib.backend_tools.default_tools={'back': <class 'matplotlib.backend_tools.ToolBack'>, 'copy': 'ToolCopyToClipboard', 'cursor': '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': 'ToolHelp', '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': 'ToolRubberband', 'save': 'ToolSaveFigure', 'subplots': 'ToolConfigureSubplots', 'viewpos': <class 'matplotlib.backend_tools.ToolViewsPositions'>, 'xscale': <class 'matplotlib.backend_tools.ToolXScale'>, 'yscale': <class 'matplotlib.backend_tools.ToolYScale'>, 'zoom': <class 'matplotlib.backend_tools.ToolZoom'>}

Default tools


matplotlib.backend_tools.add_tools_to_container(container, tools=[['navigation', ['home', 'back', 'forward']], ['zoompan', ['pan', 'zoom', 'subplots']], ['io', ['save', 'help']]])[source]

Add multiple tools to the container.  Parameters

containerContainer

backend_bases.ToolContainerBase object that will get the tools added.
toolslist, optional

List in the form [[group1, [tool1, tool2 ...]], [group2, [...]]] where the tools [tool1, tool2, ...] will display in group1. See add_tool for details.


matplotlib.backend_tools.add_tools_to_manager(toolmanager, tools={'back': <class 'matplotlib.backend_tools.ToolBack'>, 'copy': 'ToolCopyToClipboard', 'cursor': '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': 'ToolHelp', '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': 'ToolRubberband', 'save': 'ToolSaveFigure', 'subplots': 'ToolConfigureSubplots', 'viewpos': <class 'matplotlib.backend_tools.ToolViewsPositions'>, 'xscale': <class 'matplotlib.backend_tools.ToolXScale'>, 'yscale': <class 'matplotlib.backend_tools.ToolYScale'>, 'zoom': <class 'matplotlib.backend_tools.ToolZoom'>})[source]

Add multiple tools to a ToolManager.  Parameters

toolmanagerbackend_managers.ToolManager

Manager to which the tools are added.
tools{str: class_like}, optional

The tools to add in a {name: tool} dict, see add_tool for more info.


classmatplotlib.backend_tools.AxisScaleBase(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.ToolToggleBase Base Tool to toggle between linear and logarithmic.   disable(event)[source]

Disable the toggle tool. trigger call this method when toggled is True. This can happen in different circumstances.  Click on the toolbar tool button. Call to matplotlib.backend_managers.ToolManager.trigger_tool. Another ToolToggleBase derived tool is triggered (from the same ToolManager).
   enable(event)[source]

Enable the toggle tool. trigger calls this method when toggled is False.
   trigger(sender, event, data=None)[source]

Calls enable or disable based on toggled value.


disable(event)[source]

Disable the toggle tool. trigger call this method when toggled is True. This can happen in different circumstances.  Click on the toolbar tool button. Call to matplotlib.backend_managers.ToolManager.trigger_tool. Another ToolToggleBase derived tool is triggered (from the same ToolManager).


enable(event)[source]

Enable the toggle tool. trigger calls this method when toggled is False.


trigger(sender, event, data=None)[source]

Calls enable or disable based on toggled value.


classmatplotlib.backend_tools.ConfigureSubplotsBase(toolmanager, name)[source]

Bases: matplotlib.backend_tools.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='subplots'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


description='Configure subplots'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


image='subplots'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


matplotlib.backend_tools.cursors[source]

alias of matplotlib.backend_tools.Cursors


classmatplotlib.backend_tools.Cursors(value)[source]

Bases: enum.IntEnum Backend-independent cursor types.   HAND=2[source]

   MOVE=4[source]

   POINTER=1[source]

   RESIZE_HORIZONTAL=6[source]

   RESIZE_VERTICAL=7[source]

   SELECT_REGION=3[source]

   WAIT=5[source]


matplotlib.backend_tools.default_toolbar_tools=[['navigation', ['home', 'back', 'forward']], ['zoompan', ['pan', 'zoom', 'subplots']], ['io', ['save', 'help']]]

Default tools in the toolbar


matplotlib.backend_tools.default_tools={'back': <class 'matplotlib.backend_tools.ToolBack'>, 'copy': 'ToolCopyToClipboard', 'cursor': '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': 'ToolHelp', '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': 'ToolRubberband', 'save': 'ToolSaveFigure', 'subplots': 'ToolConfigureSubplots', 'viewpos': <class 'matplotlib.backend_tools.ToolViewsPositions'>, 'xscale': <class 'matplotlib.backend_tools.ToolXScale'>, 'yscale': <class 'matplotlib.backend_tools.ToolYScale'>, 'zoom': <class 'matplotlib.backend_tools.ToolZoom'>}

Default tools


classmatplotlib.backend_tools.RubberbandBase(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Draw and remove a rubberband.   draw_rubberband(*data)[source]

Draw rubberband. This method must get implemented per backend.
   remove_rubberband()[source]

Remove rubberband. This method should get implemented per backend.
   trigger(sender, event, data)[source]

Call draw_rubberband or remove_rubberband based on data.


draw_rubberband(*data)[source]

Draw rubberband. This method must get implemented per backend.


remove_rubberband()[source]

Remove rubberband. This method should get implemented per backend.


trigger(sender, event, data)[source]

Call draw_rubberband or remove_rubberband based on data.


classmatplotlib.backend_tools.SaveFigureBase(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Base tool for figure saving.   default_keymap=['s', 'ctrl+s']

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.
   description='Save the figure'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   image='filesave'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


default_keymap=['s', 'ctrl+s']

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.


description='Save the figure'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


image='filesave'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


classmatplotlib.backend_tools.SetCursorBase(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.ToolBase Change to the current cursor while inaxes. This tool, keeps track of all ToolToggleBase derived tools, and calls set_cursor when a tool gets triggered.   set_cursor(cursor)[source]

[Deprecated] Set the cursor. Notes  Deprecated since version 3.5.
   set_figure(figure)[source]


set_cursor(cursor)[source]

[Deprecated] Set the cursor. Notes  Deprecated since version 3.5.


classmatplotlib.backend_tools.ToolBack(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ViewsPositionsBase Move back up the view limits stack.   default_keymap=['left', 'c', 'backspace', 'MouseButton.BACK']

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.
   description='Back to previous view'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   image='back'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


default_keymap=['left', 'c', 'backspace', 'MouseButton.BACK']

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.


description='Back to previous view'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


image='back'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


classmatplotlib.backend_tools.ToolBase(toolmanager, name)[source]

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.   propertycanvas

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.
   description=None

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   destroy()[source]

Destroy the tool. This method is called by ToolManager.remove_tool.
   propertyfigure

The Figure affected by this tool, or None.
   image=None

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.
   propertyname

The tool id (str, must be unique among tools of a tool manager).
   set_figure(figure)[source]

   propertytoolmanager

The ToolManager that controls this tool.
   trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.


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.


description=None

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


destroy()[source]

Destroy the tool. This method is called by ToolManager.remove_tool.


image=None

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.


matplotlib.backend_tools.ToolCopyToClipboard[source]

alias of matplotlib.backend_tools.ToolCopyToClipboardBase


classmatplotlib.backend_tools.ToolCopyToClipboardBase(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Tool to copy the figure to the clipboard.   default_keymap=['ctrl+c', 'cmd+c']

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.
   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)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.


default_keymap=['ctrl+c', 'cmd+c']

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.


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)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.


classmatplotlib.backend_tools.ToolCursorPosition(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.ToolBase Send message with the current pointer position. This tool runs in the background reporting the position of the cursor.   send_message(event)[source]

Call matplotlib.backend_managers.ToolManager.message_event.
   set_figure(figure)[source]


send_message(event)[source]

Call matplotlib.backend_managers.ToolManager.message_event.


classmatplotlib.backend_tools.ToolForward(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ViewsPositionsBase Move forward in the view lim stack.   default_keymap=['right', 'v', 'MouseButton.FORWARD']

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.
   description='Forward to next view'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   image='forward'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


default_keymap=['right', 'v', 'MouseButton.FORWARD']

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.


description='Forward to next view'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


image='forward'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


classmatplotlib.backend_tools.ToolFullScreen(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.ToolToggleBase Tool to toggle full screen.   default_keymap=['f', 'ctrl+f']

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.
   description='Toggle fullscreen mode'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   disable(event)[source]

Disable the toggle tool. trigger call this method when toggled is True. This can happen in different circumstances.  Click on the toolbar tool button. Call to matplotlib.backend_managers.ToolManager.trigger_tool. Another ToolToggleBase derived tool is triggered (from the same ToolManager).
   enable(event)[source]

Enable the toggle tool. trigger calls this method when toggled is False.


default_keymap=['f', 'ctrl+f']

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.


description='Toggle fullscreen mode'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


disable(event)[source]

Disable the toggle tool. trigger call this method when toggled is True. This can happen in different circumstances.  Click on the toolbar tool button. Call to matplotlib.backend_managers.ToolManager.trigger_tool. Another ToolToggleBase derived tool is triggered (from the same ToolManager).


enable(event)[source]

Enable the toggle tool. trigger calls this method when toggled is False.


classmatplotlib.backend_tools.ToolGrid(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Tool to toggle the major grids of the figure.   default_keymap=['g']

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.
   description='Toggle major grids'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.


default_keymap=['g']

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.


description='Toggle major grids'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.


classmatplotlib.backend_tools.ToolHelpBase(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase   default_keymap=['f1']

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.
   description='Print tool list, shortcuts and description'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   staticformat_shortcut(key_sequence)[source]

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='help'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


default_keymap=['f1']

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.


description='Print tool list, shortcuts and description'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


staticformat_shortcut(key_sequence)[source]

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='help'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


classmatplotlib.backend_tools.ToolHome(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ViewsPositionsBase Restore the original view limits.   default_keymap=['h', 'r', 'home']

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.
   description='Reset original view'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   image='home'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


default_keymap=['h', 'r', 'home']

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.


description='Reset original view'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


image='home'

Filename of the image. str: Filename of the image to use in a Toolbar. If None, the name is used as a label in the toolbar button.


classmatplotlib.backend_tools.ToolMinorGrid(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Tool to toggle the major and minor grids of the figure.   default_keymap=['G']

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.
   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)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.


default_keymap=['G']

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.


description='Toggle major and minor grids'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


classmatplotlib.backend_tools.ToolPan(*args)[source]

Bases: matplotlib.backend_tools.ZoomPanBase Pan axes with left mouse, zoom with right.   cursor=4[source]

Cursor to use when the tool is active.
   default_keymap=['p']

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.
   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='move'

Filename of the image. str: Filename of the image to use in a Toolbar. 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.


cursor=4[source]

Cursor to use when the tool is active.


default_keymap=['p']

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.


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='move'

Filename of the image. str: Filename of the image to use in a Toolbar. 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.


classmatplotlib.backend_tools.ToolQuit(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Tool to call the figure manager destroy method.   default_keymap=['ctrl+w', 'cmd+w', 'q']

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.
   description='Quit the figure'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.


default_keymap=['ctrl+w', 'cmd+w', 'q']

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.


description='Quit the figure'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.


classmatplotlib.backend_tools.ToolQuitAll(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Tool to call the figure manager destroy method.   default_keymap=[]

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.
   description='Quit all figures'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.


default_keymap=[]

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.


description='Quit all figures'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


matplotlib.backend_tools.ToolSetCursor[source]

alias of matplotlib.backend_tools.SetCursorBase


classmatplotlib.backend_tools.ToolToggleBase(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.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)[source]

Disable the toggle tool. trigger call this method when toggled is True. This can happen in different circumstances.  Click on the toolbar tool button. Call to matplotlib.backend_managers.ToolManager.trigger_tool. Another ToolToggleBase derived tool is triggered (from the same ToolManager).
   enable(event=None)[source]

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)[source]

   propertytoggled

State of the toggled tool.
   trigger(sender, event, data=None)[source]

Calls enable or disable based on toggled value.


cursor=None

Cursor to use when the tool is active.


default_toggled=False

Default of toggled state.


disable(event=None)[source]

Disable the toggle tool. trigger call this method when toggled is True. This can happen in different circumstances.  Click on the toolbar tool button. Call to matplotlib.backend_managers.ToolManager.trigger_tool. Another ToolToggleBase derived tool is triggered (from the same ToolManager).


enable(event=None)[source]

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.


trigger(sender, event, data=None)[source]

Calls enable or disable based on toggled value.


classmatplotlib.backend_tools.ToolViewsPositions(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.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.  ToolZoom ToolPan ToolHome ToolBack ToolForward    add_figure(figure)[source]

Add the current figure to the stack of views and positions.
   back()[source]

Back one step in the stack of views and positions.
   clear(figure)[source]

Reset the axes stack.
   forward()[source]

Forward one step in the stack of views and positions.
   home()[source]

Recall the first view and position from the stack.
   push_current(figure=None)[source]

Push the current view limits and position onto their respective stacks.
   update_home_views(figure=None)[source]

Make sure that self.home_views has an entry for all axes present in the figure.
   update_view()[source]

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.


add_figure(figure)[source]

Add the current figure to the stack of views and positions.


back()[source]

Back one step in the stack of views and positions.


clear(figure)[source]

Reset the axes stack.


forward()[source]

Forward one step in the stack of views and positions.


home()[source]

Recall the first view and position from the stack.


push_current(figure=None)[source]

Push the current view limits and position onto their respective stacks.


update_home_views(figure=None)[source]

Make sure that self.home_views has an entry for all axes present in the figure.


update_view()[source]

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.


classmatplotlib.backend_tools.ToolXScale(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.AxisScaleBase Tool to toggle between linear and logarithmic scales on the X axis.   default_keymap=['k', 'L']

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.
   description='Toggle scale X axis'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   set_scale(ax, scale)[source]


default_keymap=['k', 'L']

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.


description='Toggle scale X axis'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


classmatplotlib.backend_tools.ToolYScale(*args, **kwargs)[source]

Bases: matplotlib.backend_tools.AxisScaleBase Tool to toggle between linear and logarithmic scales on the Y axis.   default_keymap=['l']

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.
   description='Toggle scale Y axis'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   set_scale(ax, scale)[source]


default_keymap=['l']

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.


description='Toggle scale Y axis'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


classmatplotlib.backend_tools.ToolZoom(*args)[source]

Bases: matplotlib.backend_tools.ZoomPanBase A Tool for zooming using a rectangle selector.   cursor=3[source]

Cursor to use when the tool is active.
   default_keymap=['o']

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.
   description='Zoom to rectangle'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
   image='zoom_to_rect'

Filename of the image. str: Filename of the image to use in a Toolbar. 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.


cursor=3[source]

Cursor to use when the tool is active.


default_keymap=['o']

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.


description='Zoom to rectangle'

Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.


image='zoom_to_rect'

Filename of the image. str: Filename of the image to use in a Toolbar. 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.


classmatplotlib.backend_tools.ViewsPositionsBase(toolmanager, name)[source]

Bases: matplotlib.backend_tools.ToolBase Base class for ToolHome, ToolBack and ToolForward.   trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.


trigger(sender, event, data=None)[source]

Called when this tool gets used. This method is called by ToolManager.trigger_tool.  Parameters

eventEvent

The canvas event that caused this tool to be called.
senderobject

Object that requested the tool to be triggered.
dataobject

Extra data.


classmatplotlib.backend_tools.ZoomPanBase(*args)[source]

Bases: matplotlib.backend_tools.ToolToggleBase Base class for ToolZoom and ToolPan.   disable(event)[source]

Release the canvas and disconnect press/release events.
   enable(event)[source]

Connect press/release events and lock the canvas.
   scroll_zoom(event)[source]

   trigger(sender, event, data=None)[source]

Calls enable or disable based on toggled value.


disable(event)[source]

Release the canvas and disconnect press/release events.


enable(event)[source]

Connect press/release events and lock the canvas.


trigger(sender, event, data=None)[source]

Calls enable or disable based on toggled value.


backend_webagg Displays Agg images in the browser, with interactivity   matplotlib.backends.backend_webagg.FigureCanvas[source]

alias of matplotlib.backends.backend_webagg.FigureCanvasWebAgg
   classmatplotlib.backends.backend_webagg.FigureCanvasWebAgg(*args, **kwargs)[source]

Bases: matplotlib.backends.backend_webagg_core.FigureCanvasWebAggCore
   classmatplotlib.backends.backend_webagg.ServerThread(group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None)[source]

Bases: threading.Thread This constructor should always be called with keyword arguments. Arguments are: group should be None; reserved for future extension when a ThreadGroup class is implemented. target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called. name is the thread name. By default, a unique name is constructed of the form "Thread-N" where N is a small decimal number. args is the argument tuple for the target invocation. Defaults to (). kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}. If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.   run()[source]

Method representing the thread's activity. You may override this method in a subclass. The standard run() method invokes the callable object passed to the object's constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

   classmatplotlib.backends.backend_webagg.WebAggApplication(url_prefix='')[source]

Bases: tornado.web.Application   classAllFiguresPage(application, request, *, url_prefix='', **kwargs)[source]

Bases: tornado.web.RequestHandler   get()[source]

   classDownload(application:tornado.web.Application, request:tornado.httputil.HTTPServerRequest, **kwargs:Any)[source]

Bases: tornado.web.RequestHandler   get(fignum, fmt)[source]

   classFavIcon(application:tornado.web.Application, request:tornado.httputil.HTTPServerRequest, **kwargs:Any)[source]

Bases: tornado.web.RequestHandler   get()[source]

   classMplJs(application:tornado.web.Application, request:tornado.httputil.HTTPServerRequest, **kwargs:Any)[source]

Bases: tornado.web.RequestHandler   get()[source]

   classSingleFigurePage(application, request, *, url_prefix='', **kwargs)[source]

Bases: tornado.web.RequestHandler   get(fignum)[source]

   classWebSocket(application:tornado.web.Application, request:tornado.httputil.HTTPServerRequest, **kwargs:Any)[source]

Bases: tornado.websocket.WebSocketHandler   on_close()[source]

Invoked when the WebSocket is closed. If the connection was closed cleanly and a status code or reason phrase was supplied, these values will be available as the attributes self.close_code and self.close_reason.  Changed in version 4.0: Added close_code and close_reason attributes.
   on_message(message)[source]

Handle incoming messages on the WebSocket This method must be overridden.  Changed in version 4.5: on_message can be a coroutine.
   open(fignum)[source]

Invoked when a new WebSocket is opened. The arguments to open are extracted from the tornado.web.URLSpec regular expression, just like the arguments to tornado.web.RequestHandler.get. open may be a coroutine. on_message will not be called until open has returned.  Changed in version 5.1: open may be a coroutine.
   send_binary(blob)[source]

   send_json(content)[source]

   supports_binary=True

   classmethodinitialize(url_prefix='', port=None, address=None)[source]

   initialized=False

   classmethodstart()[source]

   started=False

   matplotlib.backends.backend_webagg.ipython_inline_display(figure)[source]

   matplotlib.backends.backend_webagg.show()[source]

Show all figures. show blocks by calling mainloop if block is True, or if it is None and we are neither in IPython's %pylab mode, nor in interactive mode.


matplotlib.backends  backend_mixed backend_template backend_agg backend_cairo backend_gtk3agg, backend_gtk3cairo backend_gtk4agg, backend_gtk4cairo backend_nbagg backend_pdf backend_pgf backend_ps backend_qtagg, backend_qtcairo backend_svg backend_tkagg, backend_tkcairo backend_webagg backend_wxagg, backend_wxcairo


matplotlib.backends.backend_agg.FigureCanvas[source]

alias of matplotlib.backends.backend_agg.FigureCanvasAgg


classmatplotlib.backends.backend_agg.FigureCanvasAgg(figure=None)[source]

Bases: matplotlib.backend_bases.FigureCanvasBase   buffer_rgba()[source]

Get the image as a memoryview to the renderer's buffer. draw must be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure.
   copy_from_bbox(bbox)[source]

   draw()[source]

Render the Figure. It is important that this method actually walk the artist tree even if not output is produced because this will trigger deferred work (like computing limits auto-limits and tick values) that users may want access to before saving to disk.
   get_renderer(cleared=False)[source]

   print_jpeg(filename_or_obj, *args, pil_kwargs=None, **kwargs)[source]

Write the figure to a JPEG file.  Parameters

filename_or_objstr or path-like or file-like

The file to write to.    Other Parameters

pil_kwargsdict, optional

Additional keyword arguments that are passed to PIL.Image.Image.save when saving the figure.
   print_jpg(filename_or_obj, *args, pil_kwargs=None, **kwargs)[source]

Write the figure to a JPEG file.  Parameters

filename_or_objstr or path-like or file-like

The file to write to.    Other Parameters

pil_kwargsdict, optional

Additional keyword arguments that are passed to PIL.Image.Image.save when saving the figure.
   print_png(filename_or_obj, *args, metadata=None, pil_kwargs=None)[source]

Write the figure to a PNG file.  Parameters

filename_or_objstr or path-like or file-like

The file to write to.
metadatadict, optional

Metadata in the PNG file as key-value pairs of bytes or latin-1 encodable strings. According to the PNG specification, keys must be shorter than 79 chars. The PNG specification defines some common keywords that may be used as appropriate:  Title: Short (one line) title or caption for image. Author: Name of image's creator. Description: Description of image (possibly long). Copyright: Copyright notice. Creation Time: Time of original image creation (usually RFC 1123 format). Software: Software used to create the image. Disclaimer: Legal disclaimer. Warning: Warning of nature of content. Source: Device used to create the image. Comment: Miscellaneous comment; conversion from other image format.  Other keywords may be invented for other purposes. If 'Software' is not given, an autogenerated value for Matplotlib will be used. This can be removed by setting it to None. For more details see the PNG specification.
pil_kwargsdict, optional

Keyword arguments passed to PIL.Image.Image.save. If the 'pnginfo' key is present, it completely overrides metadata, including the default 'Software' key.
   print_raw(filename_or_obj, *args)[source]

   print_rgba(filename_or_obj, *args)[source]

   print_tif(filename_or_obj, *, pil_kwargs=None)[source]

   print_tiff(filename_or_obj, *, pil_kwargs=None)[source]

   print_to_buffer()[source]

   restore_region(region, bbox=None, xy=None)[source]

   tostring_argb()[source]

Get the image as ARGB bytes. draw must be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure.
   tostring_rgb()[source]

Get the image as RGB bytes. draw must be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure.


buffer_rgba()[source]

Get the image as a memoryview to the renderer's buffer. draw must be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure.


draw()[source]

Render the Figure. It is important that this method actually walk the artist tree even if not output is produced because this will trigger deferred work (like computing limits auto-limits and tick values) that users may want access to before saving to disk.


print_jpeg(filename_or_obj, *args, pil_kwargs=None, **kwargs)[source]

Write the figure to a JPEG file.  Parameters

filename_or_objstr or path-like or file-like

The file to write to.    Other Parameters

pil_kwargsdict, optional

Additional keyword arguments that are passed to PIL.Image.Image.save when saving the figure.


print_jpg(filename_or_obj, *args, pil_kwargs=None, **kwargs)[source]

Write the figure to a JPEG file.  Parameters

filename_or_objstr or path-like or file-like

The file to write to.    Other Parameters

pil_kwargsdict, optional

Additional keyword arguments that are passed to PIL.Image.Image.save when saving the figure.


print_png(filename_or_obj, *args, metadata=None, pil_kwargs=None)[source]

Write the figure to a PNG file.  Parameters

filename_or_objstr or path-like or file-like

The file to write to.
metadatadict, optional

Metadata in the PNG file as key-value pairs of bytes or latin-1 encodable strings. According to the PNG specification, keys must be shorter than 79 chars. The PNG specification defines some common keywords that may be used as appropriate:  Title: Short (one line) title or caption for image. Author: Name of image's creator. Description: Description of image (possibly long). Copyright: Copyright notice. Creation Time: Time of original image creation (usually RFC 1123 format). Software: Software used to create the image. Disclaimer: Legal disclaimer. Warning: Warning of nature of content. Source: Device used to create the image. Comment: Miscellaneous comment; conversion from other image format.  Other keywords may be invented for other purposes. If 'Software' is not given, an autogenerated value for Matplotlib will be used. This can be removed by setting it to None. For more details see the PNG specification.
pil_kwargsdict, optional

Keyword arguments passed to PIL.Image.Image.save. If the 'pnginfo' key is present, it completely overrides metadata, including the default 'Software' key.


tostring_argb()[source]

Get the image as ARGB bytes. draw must be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure.


tostring_rgb()[source]

Get the image as RGB bytes. draw must be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure.


classmatplotlib.backends.backend_agg.RendererAgg(width, height, dpi)[source]

Bases: matplotlib.backend_bases.RendererBase The renderer handles all the drawing primitives using a graphics context instance that controls the colors/styles   buffer_rgba()[source]

   clear()[source]

   draw_mathtext(gc, x, y, s, prop, angle)[source]

Draw mathtext using matplotlib.mathtext.
   draw_path(gc, path, transform, rgbFace=None)[source]

Draw a Path instance using the given affine transform.
   draw_tex(gc, x, y, s, prop, angle, *, mtext=None)[source]

   draw_text(gc, x, y, s, prop, angle, ismath=False, mtext=None)[source]

Draw the text instance.  Parameters

gcGraphicsContextBase

The graphics context.
xfloat

The x location of the text in display coords.
yfloat

The y location of the text baseline in display coords.
sstr

The text string.
propmatplotlib.font_manager.FontProperties

The font properties.
anglefloat

The rotation angle in degrees anti-clockwise.
mtextmatplotlib.text.Text

The original text object to be rendered.     Notes Note for backend implementers: When you are trying to determine if you have gotten your bounding box right (which is what enables the text layout/alignment to work properly), it helps to change the line in text.py: if 0: bbox_artist(self, renderer)
 to if 1, and then the actual bounding box will be plotted along with your text.
   get_canvas_width_height()[source]

Return the canvas width and height in display coords.
   get_content_extents()[source]

[Deprecated] Notes  Deprecated since version 3.4:
   get_text_width_height_descent(s, prop, ismath)[source]

Get the width, height, and descent (offset from the bottom to the baseline), in display coords, of the string s with FontProperties prop.
   lock=<unlocked _thread.RLock object owner=0 count=0>

   option_image_nocomposite()[source]

Return whether image composition by Matplotlib should be skipped. Raster backends should usually return False (letting the C-level rasterizer take care of image composition); vector backends should usually return not rcParams["image.composite_image"].
   option_scale_image()[source]

Return whether arbitrary affine transformations in draw_image() are supported (True for most vector backends).
   points_to_pixels(points)[source]

Convert points to display units. You need to override this function (unless your backend doesn't have a dpi, e.g., postscript or svg). Some imaging systems assume some value for pixels per inch: points to pixels = points * pixels_per_inch/72 * dpi/72
  Parameters

pointsfloat or array-like

a float or a numpy array of float    Returns
 Points converted to pixels

   restore_region(region, bbox=None, xy=None)[source]

Restore the saved region. If bbox (instance of BboxBase, or its extents) is given, only the region specified by the bbox will be restored. xy (a pair of floats) optionally specifies the new position (the LLC of the original region, not the LLC of the bbox) where the region will be restored. >>> region = renderer.copy_from_bbox()
>>> x1, y1, x2, y2 = region.get_extents()
>>> renderer.restore_region(region, bbox=(x1+dx, y1, x2, y2),
...                         xy=(x1-dx, y1))

   start_filter()[source]

Start filtering. It simply create a new canvas (the old one is saved).
   stop_filter(post_processing)[source]

Save the plot in the current canvas as a image and apply the post_processing function.  def post_processing(image, dpi):

# ny, nx, depth = image.shape # image (numpy array) has RGBA channels and has a depth of 4. ... # create a new_image (numpy array of 4 channels, size can be # different). The resulting image may have offsets from # lower-left corner of the original image return new_image, offset_x, offset_y   The saved renderer is restored and the returned image from post_processing is plotted (using draw_image) on it.
   tostring_argb()[source]

   tostring_rgb()[source]

   tostring_rgba_minimized()[source]

[Deprecated] Notes  Deprecated since version 3.4:


draw_mathtext(gc, x, y, s, prop, angle)[source]

Draw mathtext using matplotlib.mathtext.


draw_path(gc, path, transform, rgbFace=None)[source]

Draw a Path instance using the given affine transform.


draw_tex(gc, x, y, s, prop, angle, *, mtext=None)[source]


draw_text(gc, x, y, s, prop, angle, ismath=False, mtext=None)[source]

Draw the text instance.  Parameters

gcGraphicsContextBase

The graphics context.
xfloat

The x location of the text in display coords.
yfloat

The y location of the text baseline in display coords.
sstr

The text string.
propmatplotlib.font_manager.FontProperties

The font properties.
anglefloat

The rotation angle in degrees anti-clockwise.
mtextmatplotlib.text.Text

The original text object to be rendered.     Notes Note for backend implementers: When you are trying to determine if you have gotten your bounding box right (which is what enables the text layout/alignment to work properly), it helps to change the line in text.py: if 0: bbox_artist(self, renderer)
 to if 1, and then the actual bounding box will be plotted along with your text.


get_canvas_width_height()[source]

Return the canvas width and height in display coords.


get_content_extents()[source]

[Deprecated] Notes  Deprecated since version 3.4:


get_text_width_height_descent(s, prop, ismath)[source]

Get the width, height, and descent (offset from the bottom to the baseline), in display coords, of the string s with FontProperties prop.


lock=<unlocked _thread.RLock object owner=0 count=0>


option_image_nocomposite()[source]

Return whether image composition by Matplotlib should be skipped. Raster backends should usually return False (letting the C-level rasterizer take care of image composition); vector backends should usually return not rcParams["image.composite_image"].


option_scale_image()[source]

Return whether arbitrary affine transformations in draw_image() are supported (True for most vector backends).


points_to_pixels(points)[source]

Convert points to display units. You need to override this function (unless your backend doesn't have a dpi, e.g., postscript or svg). Some imaging systems assume some value for pixels per inch: points to pixels = points * pixels_per_inch/72 * dpi/72
  Parameters

pointsfloat or array-like

a float or a numpy array of float    Returns
 Points converted to pixels


restore_region(region, bbox=None, xy=None)[source]

Restore the saved region. If bbox (instance of BboxBase, or its extents) is given, only the region specified by the bbox will be restored. xy (a pair of floats) optionally specifies the new position (the LLC of the original region, not the LLC of the bbox) where the region will be restored. >>> region = renderer.copy_from_bbox()
>>> x1, y1, x2, y2 = region.get_extents()
>>> renderer.restore_region(region, bbox=(x1+dx, y1, x2, y2),
...                         xy=(x1-dx, y1))


start_filter()[source]

Start filtering. It simply create a new canvas (the old one is saved).


stop_filter(post_processing)[source]

Save the plot in the current canvas as a image and apply the post_processing function.  def post_processing(image, dpi):

# ny, nx, depth = image.shape # image (numpy array) has RGBA channels and has a depth of 4. ... # create a new_image (numpy array of 4 channels, size can be # different). The resulting image may have offsets from # lower-left corner of the original image return new_image, offset_x, offset_y   The saved renderer is restored and the returned image from post_processing is plotted (using draw_image) on it.


tostring_rgba_minimized()[source]

[Deprecated] Notes  Deprecated since version 3.4:


matplotlib.backends.backend_cairo.FigureCanvas[source]

alias of matplotlib.backends.backend_cairo.FigureCanvasCairo


classmatplotlib.backends.backend_cairo.FigureCanvasCairo(figure=None)[source]

Bases: matplotlib.backend_bases.FigureCanvasBase   copy_from_bbox(bbox)[source]

   print_pdf(fobj, *, orientation='portrait')

   print_png(fobj)[source]

   print_ps(fobj, *, orientation='portrait')

   print_raw(fobj)[source]

   print_rgba(fobj)[source]

   print_svg(fobj, *, orientation='portrait')

   print_svgz(fobj, *, orientation='portrait')

   restore_region(region)[source]


classmatplotlib.backends.backend_cairo.GraphicsContextCairo(renderer)[source]

Bases: matplotlib.backend_bases.GraphicsContextBase   get_rgb()[source]

Return a tuple of three or four floats from 0-1.
   restore()[source]

Restore the graphics context from the stack - needed only for backends that save graphics contexts on a stack.
   set_alpha(alpha)[source]

Set the alpha value used for blending - not supported on all backends. If alpha=None (the default), the alpha components of the foreground and fill colors will be used to set their respective transparencies (where applicable); otherwise, alpha will override them.
   set_antialiased(b)[source]

Set whether object should be drawn with antialiased rendering.
   set_capstyle(cs)[source]

Set how to draw endpoints of lines.  Parameters

csCapStyle or {'butt', 'projecting', 'round'}

   set_clip_path(path)[source]

Set the clip path to a TransformedPath or None.
   set_clip_rectangle(rectangle)[source]

Set the clip rectangle to a Bbox or None.
   set_dashes(offset, dashes)[source]

Set the dash style for the gc.  Parameters

dash_offsetfloat

The offset (usually 0).
dash_listarray-like or None

The on-off sequence as points. None specifies a solid line.     Notes See p. 107 of to PostScript blue book for more info.
   set_foreground(fg, isRGBA=None)[source]

Set the foreground color.  Parameters

fgcolor

isRGBAbool

If fg is known to be an (r, g, b, a) tuple, isRGBA can be set to True to improve performance.
   set_joinstyle(js)[source]

Set how to draw connections between line segments.  Parameters

jsJoinStyle or {'miter', 'round', 'bevel'}

   set_linewidth(w)[source]

Set the linewidth in points.


get_rgb()[source]

Return a tuple of three or four floats from 0-1.


restore()[source]

Restore the graphics context from the stack - needed only for backends that save graphics contexts on a stack.


set_alpha(alpha)[source]

Set the alpha value used for blending - not supported on all backends. If alpha=None (the default), the alpha components of the foreground and fill colors will be used to set their respective transparencies (where applicable); otherwise, alpha will override them.


set_antialiased(b)[source]

Set whether object should be drawn with antialiased rendering.


set_capstyle(cs)[source]

Set how to draw endpoints of lines.  Parameters

csCapStyle or {'butt', 'projecting', 'round'}


set_clip_path(path)[source]

Set the clip path to a TransformedPath or None.


set_clip_rectangle(rectangle)[source]

Set the clip rectangle to a Bbox or None.


set_dashes(offset, dashes)[source]

Set the dash style for the gc.  Parameters

dash_offsetfloat

The offset (usually 0).
dash_listarray-like or None

The on-off sequence as points. None specifies a solid line.     Notes See p. 107 of to PostScript blue book for more info.


set_foreground(fg, isRGBA=None)[source]

Set the foreground color.  Parameters

fgcolor

isRGBAbool

If fg is known to be an (r, g, b, a) tuple, isRGBA can be set to True to improve performance.


set_joinstyle(js)[source]

Set how to draw connections between line segments.  Parameters

jsJoinStyle or {'miter', 'round', 'bevel'}


set_linewidth(w)[source]

Set the linewidth in points.


classmatplotlib.backends.backend_cairo.RendererCairo(dpi)[source]

Bases: matplotlib.backend_bases.RendererBase   draw_image(gc, x, y, im)[source]

Draw an RGBA image.  Parameters

gcGraphicsContextBase

A graphics context with clipping information.
xscalar

The distance in physical units (i.e., dots or pixels) from the left hand side of the canvas.
yscalar

The distance in physical units (i.e., dots or pixels) from the bottom side of the canvas.
im(N, M, 4) array-like of np.uint8

An array of RGBA pixels.
transformmatplotlib.transforms.Affine2DBase

If and only if the concrete backend is written such that option_scale_image() returns True, an affine transformation (i.e., an Affine2DBase) may be passed to draw_image(). The translation vector of the transformation is given in physical units (i.e., dots or pixels). Note that the transformation does not override x and y, and has to be applied before translating the result by x and y (this can be accomplished by adding x and y to the translation vector defined by transform).
   draw_markers(gc, marker_path, marker_trans, path, transform, rgbFace=None)[source]

Draw a marker at each of path's vertices (excluding control points). This provides a fallback implementation of draw_markers that makes multiple calls to draw_path(). Some backends may want to override this method in order to draw the marker only once and reuse it multiple times.  Parameters

gcGraphicsContextBase

The graphics context.
marker_transmatplotlib.transforms.Transform

An affine transform applied to the marker.
transmatplotlib.transforms.Transform

An affine transform applied to the path.
   draw_path(gc, path, transform, rgbFace=None)[source]

Draw a Path instance using the given affine transform.
   draw_text(gc, x, y, s, prop, angle, ismath=False, mtext=None)[source]

Draw the text instance.  Parameters

gcGraphicsContextBase

The graphics context.
xfloat

The x location of the text in display coords.
yfloat

The y location of the text baseline in display coords.
sstr

The text string.
propmatplotlib.font_manager.FontProperties

The font properties.
anglefloat

The rotation angle in degrees anti-clockwise.
mtextmatplotlib.text.Text

The original text object to be rendered.     Notes Note for backend implementers: When you are trying to determine if you have gotten your bounding box right (which is what enables the text layout/alignment to work properly), it helps to change the line in text.py: if 0: bbox_artist(self, renderer)
 to if 1, and then the actual bounding box will be plotted along with your text.
   get_canvas_width_height()[source]

Return the canvas width and height in display coords.
   get_text_width_height_descent(s, prop, ismath)[source]

Get the width, height, and descent (offset from the bottom to the baseline), in display coords, of the string s with FontProperties prop.
   propertymathtext_parser[source]

   new_gc()[source]

Return an instance of a GraphicsContextBase.
   points_to_pixels(points)[source]

Convert points to display units. You need to override this function (unless your backend doesn't have a dpi, e.g., postscript or svg). Some imaging systems assume some value for pixels per inch: points to pixels = points * pixels_per_inch/72 * dpi/72
  Parameters

pointsfloat or array-like

a float or a numpy array of float    Returns
 Points converted to pixels

   set_ctx_from_surface(surface)[source]

   set_width_height(width, height)[source]


draw_image(gc, x, y, im)[source]

Draw an RGBA image.  Parameters

gcGraphicsContextBase

A graphics context with clipping information.
xscalar

The distance in physical units (i.e., dots or pixels) from the left hand side of the canvas.
yscalar

The distance in physical units (i.e., dots or pixels) from the bottom side of the canvas.
im(N, M, 4) array-like of np.uint8

An array of RGBA pixels.
transformmatplotlib.transforms.Affine2DBase

If and only if the concrete backend is written such that option_scale_image() returns True, an affine transformation (i.e., an Affine2DBase) may be passed to draw_image(). The translation vector of the transformation is given in physical units (i.e., dots or pixels). Note that the transformation does not override x and y, and has to be applied before translating the result by x and y (this can be accomplished by adding x and y to the translation vector defined by transform).


draw_markers(gc, marker_path, marker_trans, path, transform, rgbFace=None)[source]

Draw a marker at each of path's vertices (excluding control points). This provides a fallback implementation of draw_markers that makes multiple calls to draw_path(). Some backends may want to override this method in order to draw the marker only once and reuse it multiple times.  Parameters

gcGraphicsContextBase

The graphics context.
marker_transmatplotlib.transforms.Transform

An affine transform applied to the marker.
transmatplotlib.transforms.Transform

An affine transform applied to the path.


draw_path(gc, path, transform, rgbFace=None)[source]

Draw a Path instance using the given affine transform.


draw_text(gc, x, y, s, prop, angle, ismath=False, mtext=None)[source]

Draw the text instance.  Parameters

gcGraphicsContextBase

The graphics context.
xfloat

The x location of the text in display coords.
yfloat

The y location of the text baseline in display coords.
sstr

The text string.
propmatplotlib.font_manager.FontProperties

The font properties.
anglefloat

The rotation angle in degrees anti-clockwise.
mtextmatplotlib.text.Text

The original text object to be rendered.     Notes Note for backend implementers: When you are trying to determine if you have gotten your bounding box right (which is what enables the text layout/alignment to work properly), it helps to change the line in text.py: if 0: bbox_artist(self, renderer)
 to if 1, and then the actual bounding box will be plotted along with your text.


get_canvas_width_height()[source]

Return the canvas width and height in display coords.


get_text_width_height_descent(s, prop, ismath)[source]

Get the width, height, and descent (offset from the bottom to the baseline), in display coords, of the string s with FontProperties prop.


new_gc()[source]

Return an instance of a GraphicsContextBase.


points_to_pixels(points)[source]

Convert points to display units. You need to override this function (unless your backend doesn't have a dpi, e.g., postscript or svg). Some imaging systems assume some value for pixels per inch: points to pixels = points * pixels_per_inch/72 * dpi/72
  Parameters

pointsfloat or array-like

a float or a numpy array of float    Returns
 Points converted to pixels


classmatplotlib.backends.backend_mixed.MixedModeRenderer(figure, width, height, dpi, vector_renderer, raster_renderer_class=None, bbox_inches_restore=None)[source]

Bases: object A helper class to implement a renderer that switches between vector and raster drawing. An example may be a PDF writer, where most things are drawn with PDF vector commands, but some very complex objects, such as quad meshes, are rasterised and then output as images.  Parameters

figurematplotlib.figure.Figure

The figure instance.
widthscalar

The width of the canvas in logical units
heightscalar

The height of the canvas in logical units
dpifloat

The dpi of the canvas
vector_renderermatplotlib.backend_bases.RendererBase

An instance of a subclass of RendererBase that will be used for the vector drawing.
raster_renderer_classmatplotlib.backend_bases.RendererBase

The renderer class to use for the raster drawing. If not provided, this will use the Agg backend (which is currently the only viable option anyway.)       start_rasterizing()[source]

Enter "raster" mode. All subsequent drawing commands (until stop_rasterizing is called) will be drawn with the raster backend.
   stop_rasterizing()[source]

Exit "raster" mode. All of the drawing that was done since the last start_rasterizing call will be copied to the vector backend by calling draw_image.


start_rasterizing()[source]

Enter "raster" mode. All subsequent drawing commands (until stop_rasterizing is called) will be drawn with the raster backend.


stop_rasterizing()[source]

Exit "raster" mode. All of the drawing that was done since the last start_rasterizing call will be copied to the vector backend by calling draw_image.


classmatplotlib.backends.backend_nbagg.CommSocket(manager)[source]

Bases: object Manages the Comm connection between IPython and the browser (client). Comms are 2 way, with the CommSocket being able to publish a message via the send_json method, and handle a message with on_message. On the JS side figure.send_message and figure.ws.onmessage do the sending and receiving respectively.   is_open()[source]

   on_close()[source]

   on_message(message)[source]

   send_binary(blob)[source]

   send_json(content)[source]


matplotlib.backends.backend_nbagg.connection_info()[source]

Return a string showing the figure and connection status for the backend. This is intended as a diagnostic tool, and not for general use.


matplotlib.backends.backend_nbagg.FigureCanvas[source]

alias of matplotlib.backends.backend_nbagg.FigureCanvasNbAgg


classmatplotlib.backends.backend_nbagg.FigureCanvasNbAgg(*args, **kwargs)[source]

Bases: matplotlib.backends.backend_webagg_core.FigureCanvasWebAggCore


matplotlib.backends.backend_nbagg.FigureManager[source]

alias of matplotlib.backends.backend_nbagg.FigureManagerNbAgg


classmatplotlib.backends.backend_nbagg.FigureManagerNbAgg(canvas, num)[source]

Bases: matplotlib.backends.backend_webagg_core.FigureManagerWebAgg   ToolbarCls[source]

alias of matplotlib.backends.backend_nbagg.NavigationIPy
   clearup_closed()[source]

Clear up any closed Comms.
   propertyconnected

   destroy()[source]

   display_js()[source]

   classmethodget_javascript(stream=None)[source]

   remove_comm(comm_id)[source]

   reshow()[source]

A special method to re-show the figure in the notebook.
   show()[source]

For GUI backends, show the figure window and redraw. For non-GUI backends, raise an exception, unless running headless (i.e. on Linux with an unset DISPLAY); this exception is converted to a warning in Figure.show.


clearup_closed()[source]

Clear up any closed Comms.


reshow()[source]

A special method to re-show the figure in the notebook.


show()[source]

For GUI backends, show the figure window and redraw. For non-GUI backends, raise an exception, unless running headless (i.e. on Linux with an unset DISPLAY); this exception is converted to a warning in Figure.show.


ToolbarCls[source]

alias of matplotlib.backends.backend_nbagg.NavigationIPy


classmatplotlib.backends.backend_nbagg.NavigationIPy(canvas)[source]

Bases: matplotlib.backends.backend_webagg_core.NavigationToolbar2WebAgg   toolitems=[('Home', 'Reset original view', 'fa fa-home icon-home', 'home'), ('Back', 'Back to previous view', 'fa fa-arrow-left icon-arrow-left', 'back'), ('Forward', 'Forward to next view', 'fa fa-arrow-right icon-arrow-right', 'forward'), (None, None, None, None), ('Pan', 'Left button pans, Right button zooms\nx/y fixes axis, CTRL fixes aspect', 'fa fa-arrows icon-move', 'pan'), ('Zoom', 'Zoom to rectangle\nx/y fixes axis', 'fa fa-square-o icon-check-empty', 'zoom'), (None, None, None, None), ('Download', 'Download plot', 'fa fa-floppy-o icon-save', 'download')]


toolitems=[('Home', 'Reset original view', 'fa fa-home icon-home', 'home'), ('Back', 'Back to previous view', 'fa fa-arrow-left icon-arrow-left', 'back'), ('Forward', 'Forward to next view', 'fa fa-arrow-right icon-arrow-right', 'forward'), (None, None, None, None), ('Pan', 'Left button pans, Right button zooms\nx/y fixes axis, CTRL fixes aspect', 'fa fa-arrows icon-move', 'pan'), ('Zoom', 'Zoom to rectangle\nx/y fixes axis', 'fa fa-square-o icon-check-empty', 'zoom'), (None, None, None, None), ('Download', 'Download plot', 'fa fa-floppy-o icon-save', 'download')]


matplotlib.backends.backend_nbagg.new_figure_manager_given_figure(num, figure)[source]

Create a new figure manager instance for the given figure.


matplotlib.backends.backend_nbagg.show(block=None)[source]

Show all figures. show blocks by calling mainloop if block is True, or if it is None and we are neither in IPython's %pylab mode, nor in interactive mode.


matplotlib.backends.backend_pdf.FigureCanvas[source]

alias of matplotlib.backends.backend_pdf.FigureCanvasPdf


classmatplotlib.backends.backend_pdf.FigureCanvasPdf(figure=None)[source]

Bases: matplotlib.backend_bases.FigureCanvasBase   draw()[source]

Render the Figure. It is important that this method actually walk the artist tree even if not output is produced because this will trigger deferred work (like computing limits auto-limits and tick values) that users may want access to before saving to disk.
   filetypes={'pdf': 'Portable Document Format'}

   fixed_dpi=72

   get_default_filetype()[source]

Return the default savefig file format as specified in rcParams["savefig.format"] (default: 'png'). The returned string does not include a period. This method is overridden in backends that only support a single file type.
   print_pdf(filename, *, dpi=<deprecated parameter>, bbox_inches_restore=None, metadata=None)[source]


draw()[source]

Render the Figure. It is important that this method actually walk the artist tree even if not output is produced because this will trigger deferred work (like computing limits auto-limits and tick values) that users may want access to before saving to disk.


filetypes={'pdf': 'Portable Document Format'}


get_default_filetype()[source]

Return the default savefig file format as specified in rcParams["savefig.format"] (default: 'png'). The returned string does not include a period. This method is overridden in backends that only support a single file type.


print_pdf(filename, *, dpi=<deprecated parameter>, bbox_inches_restore=None, metadata=None)[source]


matplotlib.backends.backend_pdf.fill(strings, linelen=75)[source]

Make one string from sequence of strings, with whitespace in between. The whitespace is chosen to form lines of at most linelen characters, if possible.


classmatplotlib.backends.backend_pdf.GraphicsContextPdf(file)[source]

Bases: matplotlib.backend_bases.GraphicsContextBase   alpha_cmd(alpha, forced, effective_alphas)[source]

   capstyle_cmd(style)[source]

   capstyles={'butt': 0, 'projecting': 2, 'round': 1}

   clip_cmd(cliprect, clippath)[source]

Set clip rectangle. Calls pop() and push().
   commands=((('_cliprect', '_clippath'), <function GraphicsContextPdf.clip_cmd>), (('_alpha', '_forced_alpha', '_effective_alphas'), <function GraphicsContextPdf.alpha_cmd>), (('_capstyle',), <function GraphicsContextPdf.capstyle_cmd>), (('_fillcolor',), <function GraphicsContextPdf.fillcolor_cmd>), (('_joinstyle',), <function GraphicsContextPdf.joinstyle_cmd>), (('_linewidth',), <function GraphicsContextPdf.linewidth_cmd>), (('_dashes',), <function GraphicsContextPdf.dash_cmd>), (('_rgb',), <function GraphicsContextPdf.rgb_cmd>), (('_hatch', '_hatch_color'), <function GraphicsContextPdf.hatch_cmd>))

   copy_properties(other)[source]

Copy properties of other into self.
   dash_cmd(dashes)[source]

   delta(other)[source]

Copy properties of other into self and return PDF commands needed to transform self into other.
   fill(*args)[source]

Predicate: does the path need to be filled? An optional argument can be used to specify an alternative _fillcolor, as needed by RendererPdf.draw_markers.
   fillcolor_cmd(rgb)[source]

   finalize()[source]

Make sure every pushed graphics state is popped.
   hatch_cmd(hatch, hatch_color)[source]

   joinstyle_cmd(style)[source]

   joinstyles={'bevel': 2, 'miter': 0, 'round': 1}

   linewidth_cmd(width)[source]

   paint()[source]

Return the appropriate pdf operator to cause the path to be stroked, filled, or both.
   pop()[source]

   push()[source]

   rgb_cmd(rgb)[source]

   stroke()[source]

Predicate: does the path need to be stroked (its outline drawn)? This tests for the various conditions that disable stroking the path, in which case it would presumably be filled.


capstyles={'butt': 0, 'projecting': 2, 'round': 1}


clip_cmd(cliprect, clippath)[source]

Set clip rectangle. Calls pop() and push().


commands=((('_cliprect', '_clippath'), <function GraphicsContextPdf.clip_cmd>), (('_alpha', '_forced_alpha', '_effective_alphas'), <function GraphicsContextPdf.alpha_cmd>), (('_capstyle',), <function GraphicsContextPdf.capstyle_cmd>), (('_fillcolor',), <function GraphicsContextPdf.fillcolor_cmd>), (('_joinstyle',), <function GraphicsContextPdf.joinstyle_cmd>), (('_linewidth',), <function GraphicsContextPdf.linewidth_cmd>), (('_dashes',), <function GraphicsContextPdf.dash_cmd>), (('_rgb',), <function GraphicsContextPdf.rgb_cmd>), (('_hatch', '_hatch_color'), <function GraphicsContextPdf.hatch_cmd>))


copy_properties(other)[source]

Copy properties of other into self.


delta(other)[source]

Copy properties of other into self and return PDF commands needed to transform self into other.


fill(*args)[source]

Predicate: does the path need to be filled? An optional argument can be used to specify an alternative _fillcolor, as needed by RendererPdf.draw_markers.


finalize()[source]

Make sure every pushed graphics state is popped.


joinstyles={'bevel': 2, 'miter': 0, 'round': 1}


paint()[source]

Return the appropriate pdf operator to cause the path to be stroked, filled, or both.


stroke()[source]

Predicate: does the path need to be stroked (its outline drawn)? This tests for the various conditions that disable stroking the path, in which case it would presumably be filled.


classmatplotlib.backends.backend_pdf.Name(name)[source]

Bases: object PDF name object.   statichexify(match)[source]

   name

   pdfRepr()[source]


classmatplotlib.backends.backend_pdf.Op(value)[source]

Bases: matplotlib.backends.backend_pdf.Operator, enum.Enum An enumeration.   begin_text=(b'BT',)[source]

   clip=b'W'[source]

   close_fill_stroke=b'b'[source]

   close_stroke=b's'[source]

   closepath=(b'h',)[source]

   concat_matrix=b'cm'[source]

   curveto=b'c'[source]

   end_text=b'ET'[source]

   endpath=b'n'[source]

   fill=b'f'[source]

   fill_stroke=b'B'[source]

   grestore=b'Q'[source]

   gsave=(b'q',)[source]

   lineto=b'l'[source]

   moveto=(b'm',)[source]

   op

   classmethodpaint_path(fill, stroke)[source]

Return the PDF operator to paint a path.  Parameters

fillbool

Fill the path with the fill color.
strokebool

Stroke the outline of the path with the line color.
   rectangle=b're'[source]

   selectfont=b'Tf'[source]

   setcolor_nonstroke=b'scn'[source]

   setcolor_stroke=b'SCN'[source]

   setcolorspace_nonstroke=(b'cs',)[source]

   setcolorspace_stroke=b'CS'[source]

   setdash=(b'd',)[source]

   setgray_nonstroke=b'g'[source]

   setgray_stroke=(b'G',)[source]

   setgstate=b'gs'[source]

   setlinecap=b'J'[source]

   setlinejoin=b'j'[source]

   setlinewidth=b'w'[source]

   setrgb_nonstroke=(b'rg',)[source]

   setrgb_stroke=b'RG'[source]

   shading=b'sh'[source]

   show=b'Tj'[source]

   showkern=b'TJ'[source]

   stroke=b'S'[source]

   textmatrix=(b'Tm',)[source]

   textpos=b'Td'[source]

   use_xobject=b'Do'[source]


classmethodpaint_path(fill, stroke)[source]

Return the PDF operator to paint a path.  Parameters

fillbool

Fill the path with the fill color.
strokebool

Stroke the outline of the path with the line color.


classmatplotlib.backends.backend_pdf.Operator(op)[source]

Bases: object PDF operator object.   op

   pdfRepr()[source]


classmatplotlib.backends.backend_pdf.PdfFile(filename, metadata=None)[source]

Bases: object PDF file object.  Parameters

filenamestr or path-like or file-like

Output target; if a string, a file will be opened for writing.
metadatadict from strings to strings and dates

Information dictionary object (see PDF reference section 10.2.1 'Document Information Dictionary'), e.g.: {'Creator': 'My software', 'Author': 'Me', 'Title': 'Awesome'}. The standard keys are 'Title', 'Author', 'Subject', 'Keywords', 'Creator', 'Producer', 'CreationDate', 'ModDate', and 'Trapped'. Values have been predefined for 'Creator', 'Producer' and 'CreationDate'. They can be removed by setting them to None.       addGouraudTriangles(points, colors)[source]

Add a Gouraud triangle shading.  Parameters

pointsnp.ndarray

Triangle vertices, shape (n, 3, 2) where n = number of triangles, 3 = vertices, 2 = x, y.
colorsnp.ndarray

Vertex colors, shape (n, 3, 1) or (n, 3, 4) as with points, but last dimension is either (gray,) or (r, g, b, alpha).    Returns
 Name, Reference

   alphaState(alpha)[source]

Return name of an ExtGState that sets alpha to the given value.
   beginStream(id, len, extra=None, png=None)[source]

   close()[source]

Flush all buffers and free all resources.
   createType1Descriptor(t1font, fontfile)[source]

   dviFontName(dvifont)[source]

Given a dvi font object, return a name suitable for Op.selectfont. This registers the font information in self.dviFontInfo if not yet registered.
   embedTTF(filename, characters)[source]

Embed the TTF font from the named file into the document.
   endStream()[source]

   finalize()[source]

Write out the various deferred objects and the pdf end matter.
   fontName(fontprop)[source]

Select a font based on fontprop and return a name suitable for Op.selectfont. If fontprop is a string, it will be interpreted as the filename of the font.
   hatchPattern(hatch_style)[source]

   imageObject(image)[source]

Return name of an image XObject representing the given image.
   markerObject(path, trans, fill, stroke, lw, joinstyle, capstyle)[source]

Return name of a marker XObject representing the given path.
   newPage(width, height)[source]

   newTextnote(text, positionRect=[- 100, - 100, 0, 0])[source]

   output(*data)[source]

   pathCollectionObject(gc, path, trans, padding, filled, stroked)[source]

   staticpathOperations(path, transform, clip=None, simplify=None, sketch=None)[source]

   recordXref(id)[source]

   reserveObject(name='')[source]

Reserve an ID for an indirect object. The name is used for debugging in case we forget to print out the object with writeObject.
   write(data)[source]

   writeExtGSTates()[source]

   writeFonts()[source]

   writeGouraudTriangles()[source]

   writeHatches()[source]

   writeImages()[source]

   writeInfoDict()[source]

Write out the info dictionary, checking it for good form
   writeMarkers()[source]

   writeObject(object, contents)[source]

   writePath(path, transform, clip=False, sketch=None)[source]

   writePathCollectionTemplates()[source]

   writeTrailer()[source]

Write out the PDF trailer.
   writeXref()[source]

Write out the xref table.


addGouraudTriangles(points, colors)[source]

Add a Gouraud triangle shading.  Parameters

pointsnp.ndarray

Triangle vertices, shape (n, 3, 2) where n = number of triangles, 3 = vertices, 2 = x, y.
colorsnp.ndarray

Vertex colors, shape (n, 3, 1) or (n, 3, 4) as with points, but last dimension is either (gray,) or (r, g, b, alpha).    Returns
 Name, Reference


alphaState(alpha)[source]

Return name of an ExtGState that sets alpha to the given value.


beginStream(id, len, extra=None, png=None)[source]


close()[source]

Flush all buffers and free all resources.


dviFontName(dvifont)[source]

Given a dvi font object, return a name suitable for Op.selectfont. This registers the font information in self.dviFontInfo if not yet registered.


embedTTF(filename, characters)[source]

Embed the TTF font from the named file into the document.


finalize()[source]

Write out the various deferred objects and the pdf end matter.