doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
stop()[source] Stop the timer.
matplotlib.backend_bases_api#matplotlib.backend_bases.TimerBase.stop
classmatplotlib.backend_bases.ToolContainerBase(toolmanager)[source] Bases: object Base class for all tool containers, e.g. toolbars. Attributes toolmanagerToolManager The tools with which this ToolContainer wants to communicate. add_tool(tool, group, position=- 1)[source] Add a tool to this container. Parameters tooltool_like The tool to add, see ToolManager.get_tool. groupstr The name of the group to add this tool to. positionint, default: -1 The position within the group to place this tool. add_toolitem(name, group, position, image, description, toggle)[source] Add a toolitem to the container. This method must be implemented per backend. The callback associated with the button click event, must be exactly self.trigger_tool(name). Parameters namestr Name of the tool to add, this gets used as the tool's ID and as the default label of the buttons. groupstr Name of the group that this tool belongs to. positionint Position of the tool within its group, if -1 it goes at the end. imagestr Filename of the image for the button or None. descriptionstr Description of the tool, used for the tooltips. togglebool True : The button is a toggle (change the pressed/unpressed state between consecutive clicks). False : The button is a normal button (returns to unpressed state after release). remove_toolitem(name)[source] Remove a toolitem from the ToolContainer. This method must get implemented per backend. Called when ToolManager emits a tool_removed_event. Parameters namestr Name of the tool to remove. set_message(s)[source] Display a message on the toolbar. Parameters sstr Message text. toggle_toolitem(name, toggled)[source] Toggle the toolitem without firing event. Parameters namestr Id of the tool to toggle. toggledbool Whether to set this tool as toggled or not. trigger_tool(name)[source] Trigger the tool. Parameters namestr Name (id) of the tool triggered from within the container.
matplotlib.backend_bases_api#matplotlib.backend_bases.ToolContainerBase
add_tool(tool, group, position=- 1)[source] Add a tool to this container. Parameters tooltool_like The tool to add, see ToolManager.get_tool. groupstr The name of the group to add this tool to. positionint, default: -1 The position within the group to place this tool.
matplotlib.backend_bases_api#matplotlib.backend_bases.ToolContainerBase.add_tool
add_toolitem(name, group, position, image, description, toggle)[source] Add a toolitem to the container. This method must be implemented per backend. The callback associated with the button click event, must be exactly self.trigger_tool(name). Parameters namestr Name of the tool to add, this gets used as the tool's ID and as the default label of the buttons. groupstr Name of the group that this tool belongs to. positionint Position of the tool within its group, if -1 it goes at the end. imagestr Filename of the image for the button or None. descriptionstr Description of the tool, used for the tooltips. togglebool True : The button is a toggle (change the pressed/unpressed state between consecutive clicks). False : The button is a normal button (returns to unpressed state after release).
matplotlib.backend_bases_api#matplotlib.backend_bases.ToolContainerBase.add_toolitem
remove_toolitem(name)[source] Remove a toolitem from the ToolContainer. This method must get implemented per backend. Called when ToolManager emits a tool_removed_event. Parameters namestr Name of the tool to remove.
matplotlib.backend_bases_api#matplotlib.backend_bases.ToolContainerBase.remove_toolitem
set_message(s)[source] Display a message on the toolbar. Parameters sstr Message text.
matplotlib.backend_bases_api#matplotlib.backend_bases.ToolContainerBase.set_message
toggle_toolitem(name, toggled)[source] Toggle the toolitem without firing event. Parameters namestr Id of the tool to toggle. toggledbool Whether to set this tool as toggled or not.
matplotlib.backend_bases_api#matplotlib.backend_bases.ToolContainerBase.toggle_toolitem
trigger_tool(name)[source] Trigger the tool. Parameters namestr Name (id) of the tool triggered from within the container.
matplotlib.backend_bases_api#matplotlib.backend_bases.ToolContainerBase.trigger_tool
backend_cairo A Cairo backend for Matplotlib Author Steve Chaplin and others This backend depends on cairocffi or pycairo. 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. 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]
matplotlib.backend_cairo_api
matplotlib.backend_managers classmatplotlib.backend_managers.ToolEvent(name, sender, tool, data=None)[source] Bases: object Event for tool manipulation (add/remove). classmatplotlib.backend_managers.ToolManager(figure=None)[source] Bases: object Manager for actions triggered by user interactions (key press, toolbar clicks, ...) on a Figure. Attributes figureFigure Figure that holds the canvas. keypresslockLockDraw LockDraw object to know if the canvas key_press_event is locked. messagelockLockDraw LockDraw object to know if the message is available to write. propertyactive_toggle Currently toggled tools. add_tool(name, tool, *args, **kwargs)[source] Add tool to ToolManager. If successful, adds a new event tool_trigger_{name} where {name} is the name of the tool; the event is fired every time the tool is triggered. Parameters namestr Name of the tool, treated as the ID, has to be unique. toolclass_like, i.e. str or type Reference to find the class of the Tool to added. See also matplotlib.backend_tools.ToolBase The base class for tools. Notes args and kwargs get passed directly to the tools constructor. propertycanvas Canvas managed by FigureManager. propertyfigure Figure that holds the canvas. get_tool(name, warn=True)[source] Return the tool object with the given name. For convenience, this passes tool objects through. Parameters namestr or ToolBase Name of the tool, or the tool itself. warnbool, default: True Whether a warning should be emitted it no tool with the given name exists. Returns ToolBase or None The tool or None if no tool with the given name exists. get_tool_keymap(name)[source] Return the keymap associated with the specified tool. Parameters namestr Name of the Tool. Returns list of str List of keys associated with the tool. message_event(message, sender=None)[source] Emit a ToolManagerMessageEvent. remove_tool(name)[source] Remove tool named name. Parameters namestr Name of the tool. set_figure(figure, update_tools=True)[source] Bind the given figure to the tools. Parameters figureFigure update_toolsbool, default: True Force tools to update figure. toolmanager_connect(s, func)[source] Connect event with string s to func. Parameters sstr The name of the event. The following events are recognized: 'tool_message_event' 'tool_removed_event' 'tool_added_event' For every tool added a new event is created 'tool_trigger_TOOLNAME', where TOOLNAME is the id of the tool. funccallable Callback function for the toolmanager event with signature: def func(event: ToolEvent) -> Any Returns cid The callback id for the connection. This can be used in toolmanager_disconnect. toolmanager_disconnect(cid)[source] Disconnect callback id cid. Example usage: cid = toolmanager.toolmanager_connect('tool_trigger_zoom', onpress) #...later toolmanager.toolmanager_disconnect(cid) propertytools A dict mapping tool name -> controlled tool. trigger_tool(name, sender=None, canvasevent=None, data=None)[source] Trigger a tool and emit the tool_trigger_{name} event. Parameters namestr Name of the tool. senderobject Object that wishes to trigger the tool. canvaseventEvent Original Canvas event or None. dataobject Extra data to pass to the tool when triggering. update_keymap(name, key)[source] Set the keymap to associate with the specified tool. Parameters namestr Name of the Tool. keystr or list of str Keys to associate with the tool. classmatplotlib.backend_managers.ToolManagerMessageEvent(name, sender, message)[source] Bases: object Event carrying messages from toolmanager. Messages usually get displayed to the user by the toolbar. classmatplotlib.backend_managers.ToolTriggerEvent(name, sender, tool, canvasevent=None, data=None)[source] Bases: matplotlib.backend_managers.ToolEvent Event to inform that a tool has been triggered.
matplotlib.backend_managers_api
classmatplotlib.backend_managers.ToolEvent(name, sender, tool, data=None)[source] Bases: object Event for tool manipulation (add/remove).
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolEvent
classmatplotlib.backend_managers.ToolManager(figure=None)[source] Bases: object Manager for actions triggered by user interactions (key press, toolbar clicks, ...) on a Figure. Attributes figureFigure Figure that holds the canvas. keypresslockLockDraw LockDraw object to know if the canvas key_press_event is locked. messagelockLockDraw LockDraw object to know if the message is available to write. propertyactive_toggle Currently toggled tools. add_tool(name, tool, *args, **kwargs)[source] Add tool to ToolManager. If successful, adds a new event tool_trigger_{name} where {name} is the name of the tool; the event is fired every time the tool is triggered. Parameters namestr Name of the tool, treated as the ID, has to be unique. toolclass_like, i.e. str or type Reference to find the class of the Tool to added. See also matplotlib.backend_tools.ToolBase The base class for tools. Notes args and kwargs get passed directly to the tools constructor. propertycanvas Canvas managed by FigureManager. propertyfigure Figure that holds the canvas. get_tool(name, warn=True)[source] Return the tool object with the given name. For convenience, this passes tool objects through. Parameters namestr or ToolBase Name of the tool, or the tool itself. warnbool, default: True Whether a warning should be emitted it no tool with the given name exists. Returns ToolBase or None The tool or None if no tool with the given name exists. get_tool_keymap(name)[source] Return the keymap associated with the specified tool. Parameters namestr Name of the Tool. Returns list of str List of keys associated with the tool. message_event(message, sender=None)[source] Emit a ToolManagerMessageEvent. remove_tool(name)[source] Remove tool named name. Parameters namestr Name of the tool. set_figure(figure, update_tools=True)[source] Bind the given figure to the tools. Parameters figureFigure update_toolsbool, default: True Force tools to update figure. toolmanager_connect(s, func)[source] Connect event with string s to func. Parameters sstr The name of the event. The following events are recognized: 'tool_message_event' 'tool_removed_event' 'tool_added_event' For every tool added a new event is created 'tool_trigger_TOOLNAME', where TOOLNAME is the id of the tool. funccallable Callback function for the toolmanager event with signature: def func(event: ToolEvent) -> Any Returns cid The callback id for the connection. This can be used in toolmanager_disconnect. toolmanager_disconnect(cid)[source] Disconnect callback id cid. Example usage: cid = toolmanager.toolmanager_connect('tool_trigger_zoom', onpress) #...later toolmanager.toolmanager_disconnect(cid) propertytools A dict mapping tool name -> controlled tool. trigger_tool(name, sender=None, canvasevent=None, data=None)[source] Trigger a tool and emit the tool_trigger_{name} event. Parameters namestr Name of the tool. senderobject Object that wishes to trigger the tool. canvaseventEvent Original Canvas event or None. dataobject Extra data to pass to the tool when triggering. update_keymap(name, key)[source] Set the keymap to associate with the specified tool. Parameters namestr Name of the Tool. keystr or list of str Keys to associate with the tool.
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolManager
add_tool(name, tool, *args, **kwargs)[source] Add tool to ToolManager. If successful, adds a new event tool_trigger_{name} where {name} is the name of the tool; the event is fired every time the tool is triggered. Parameters namestr Name of the tool, treated as the ID, has to be unique. toolclass_like, i.e. str or type Reference to find the class of the Tool to added. See also matplotlib.backend_tools.ToolBase The base class for tools. Notes args and kwargs get passed directly to the tools constructor.
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolManager.add_tool
get_tool(name, warn=True)[source] Return the tool object with the given name. For convenience, this passes tool objects through. Parameters namestr or ToolBase Name of the tool, or the tool itself. warnbool, default: True Whether a warning should be emitted it no tool with the given name exists. Returns ToolBase or None The tool or None if no tool with the given name exists.
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolManager.get_tool
get_tool_keymap(name)[source] Return the keymap associated with the specified tool. Parameters namestr Name of the Tool. Returns list of str List of keys associated with the tool.
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolManager.get_tool_keymap
message_event(message, sender=None)[source] Emit a ToolManagerMessageEvent.
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolManager.message_event
remove_tool(name)[source] Remove tool named name. Parameters namestr Name of the tool.
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolManager.remove_tool
set_figure(figure, update_tools=True)[source] Bind the given figure to the tools. Parameters figureFigure update_toolsbool, default: True Force tools to update figure.
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolManager.set_figure
toolmanager_connect(s, func)[source] Connect event with string s to func. Parameters sstr The name of the event. The following events are recognized: 'tool_message_event' 'tool_removed_event' 'tool_added_event' For every tool added a new event is created 'tool_trigger_TOOLNAME', where TOOLNAME is the id of the tool. funccallable Callback function for the toolmanager event with signature: def func(event: ToolEvent) -> Any Returns cid The callback id for the connection. This can be used in toolmanager_disconnect.
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolManager.toolmanager_connect
toolmanager_disconnect(cid)[source] Disconnect callback id cid. Example usage: cid = toolmanager.toolmanager_connect('tool_trigger_zoom', onpress) #...later toolmanager.toolmanager_disconnect(cid)
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolManager.toolmanager_disconnect
trigger_tool(name, sender=None, canvasevent=None, data=None)[source] Trigger a tool and emit the tool_trigger_{name} event. Parameters namestr Name of the tool. senderobject Object that wishes to trigger the tool. canvaseventEvent Original Canvas event or None. dataobject Extra data to pass to the tool when triggering.
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolManager.trigger_tool
update_keymap(name, key)[source] Set the keymap to associate with the specified tool. Parameters namestr Name of the Tool. keystr or list of str Keys to associate with the tool.
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolManager.update_keymap
classmatplotlib.backend_managers.ToolManagerMessageEvent(name, sender, message)[source] Bases: object Event carrying messages from toolmanager. Messages usually get displayed to the user by the toolbar.
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolManagerMessageEvent
classmatplotlib.backend_managers.ToolTriggerEvent(name, sender, tool, canvasevent=None, data=None)[source] Bases: matplotlib.backend_managers.ToolEvent Event to inform that a tool has been triggered.
matplotlib.backend_managers_api#matplotlib.backend_managers.ToolTriggerEvent
backend_mixed 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.
matplotlib.backend_mixed_api
backend_nbagg Interactive figures in the IPython notebook. 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.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. 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')] 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.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.backend_nbagg_api
backend_pdf A PDF Matplotlib backend. Author: Jouni K Seppänen <jks@iki.fi> and others. 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] 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. 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] 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. classmatplotlib.backends.backend_pdf.PdfPages(filename, keep_empty=True, metadata=None)[source] Bases: object A multi-page PDF file. Notes In reality PdfPages is a thin wrapper around PdfFile, in order to avoid confusion when using savefig and forgetting the format argument. Examples >>> import matplotlib.pyplot as plt >>> # Initialize: >>> with PdfPages('foo.pdf') as pdf: ... # As many times as you like, create a figure fig and save it: ... fig = plt.figure() ... pdf.savefig(fig) ... # When no figure is specified the current figure is saved ... pdf.savefig() Create a new PdfPages object. Parameters filenamestr or path-like or file-like Plots using PdfPages.savefig will be written to a file at this location. The file is opened at once and any older file with the same name is overwritten. keep_emptybool, optional If set to False, then empty pdf files will be deleted automatically when closed. metadatadict, optional 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. attach_note(text, positionRect=[- 100, - 100, 0, 0])[source] Add a new text note to the page to be saved next. The optional positionRect specifies the position of the new note on the page. It is outside the page per default to make sure it is invisible on printouts. close()[source] Finalize this object, making the underlying file a complete PDF file. get_pagecount()[source] Return the current number of pages in the multipage pdf file. infodict()[source] Return a modifiable information dictionary object (see PDF reference section 10.2.1 'Document Information Dictionary'). keep_empty savefig(figure=None, **kwargs)[source] Save a Figure to this file as a new page. Any other keyword arguments are passed to savefig. Parameters figureFigure or int, default: the active figure The figure, or index of the figure, that is saved to the file. classmatplotlib.backends.backend_pdf.Reference(id)[source] Bases: object PDF reference object. Use PdfFile.reserveObject() to create References. pdfRepr()[source] write(contents, file)[source] classmatplotlib.backends.backend_pdf.RendererPdf(file, image_dpi, height, width)[source] Bases: matplotlib.backends._backend_pdf_ps.RendererPDFPSBase check_gc(gc, fillcolor=None)[source] draw_gouraud_triangle(gc, points, colors, trans)[source] Draw a Gouraud-shaded triangle. Parameters gcGraphicsContextBase The graphics context. points(3, 2) array-like Array of (x, y) points for the triangle. colors(3, 4) array-like RGBA colors for each point of the triangle. transformmatplotlib.transforms.Transform An affine transform to apply to the points. draw_gouraud_triangles(gc, points, colors, trans)[source] Draw a series of Gouraud triangles. Parameters points(N, 3, 2) array-like Array of N (x, y) points for the triangles. colors(N, 3, 4) array-like Array of N RGBA colors for each point of the triangles. transformmatplotlib.transforms.Transform An affine transform to apply to the points. draw_image(gc, x, y, im, transform=None)[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, trans, 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_mathtext(gc, x, y, s, prop, angle)[source] draw_path(gc, path, transform, rgbFace=None)[source] Draw a Path instance using the given affine transform. draw_path_collection(gc, master_transform, paths, all_transforms, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls, offset_position)[source] Draw a collection of paths selecting drawing properties from the lists facecolors, edgecolors, linewidths, linestyles and antialiaseds. offsets is a list of offsets to apply to each of the paths. The offsets in offsets are first transformed by offsetTrans before being applied. offset_position is unused now, but the argument is kept for backwards compatibility. This provides a fallback implementation of draw_path_collection() that makes multiple calls to draw_path(). Some backends may want to override this in order to render each set of path data only once, and then reference that path multiple times with the different offsets, colors, styles etc. The generator methods _iter_collection_raw_paths() and _iter_collection() are provided to help with (and standardize) the implementation across backends. It is highly recommended to use those generators, so that changes to the behavior of draw_path_collection() can be made globally. 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. encode_string(s, fonttype)[source] finalize()[source] get_image_magnification()[source] Get the factor by which to magnify images passed to draw_image(). Allows a backend to have images at a different resolution to other artists. propertymathtext_parser[source] new_gc()[source] Return an instance of a GraphicsContextBase. classmatplotlib.backends.backend_pdf.Stream(id, len, file, extra=None, png=None)[source] Bases: object PDF stream object. This has no pdfRepr method. Instead, call begin(), then output the contents of the stream by calling write(), and finally call end(). Parameters idint Object id of the stream. lenReference or None An unused Reference object for the length of the stream; None means to use a memory buffer so the length can be inlined. filePdfFile The underlying object to write the stream to. extradict from Name to anything, or None Extra key-value pairs to include in the stream header. pngdict or None If the data is already png encoded, the decode parameters. compressobj end()[source] Finalize stream. extra file id len pdfFile pos write(data)[source] Write some data on the stream. classmatplotlib.backends.backend_pdf.Verbatim(x)[source] Bases: object Store verbatim PDF command content for later inclusion in the stream. pdfRepr()[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. matplotlib.backends.backend_pdf.pdfRepr(obj)[source] Map Python objects to PDF syntax.
matplotlib.backend_pdf_api
backend_pgf matplotlib.backends.backend_pgf.FigureCanvas[source] alias of matplotlib.backends.backend_pgf.FigureCanvasPgf classmatplotlib.backends.backend_pgf.FigureCanvasPgf(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': 'LaTeX compiled PGF picture', 'pgf': 'LaTeX PGF picture', 'png': 'Portable Network Graphics'} 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. get_renderer()[source] print_pdf(fname_or_fh, *, metadata=None, **kwargs)[source] Use LaTeX to compile a pgf generated figure to pdf. print_pgf(fname_or_fh, **kwargs)[source] Output pgf macros for drawing the figure so it can be included and rendered in latex documents. print_png(fname_or_fh, **kwargs)[source] Use LaTeX to compile a pgf figure to pdf and convert it to png. exceptionmatplotlib.backends.backend_pgf.LatexError(message, latex_output='')[source] Bases: Exception classmatplotlib.backends.backend_pgf.LatexManager[source] Bases: object The LatexManager opens an instance of the LaTeX application for determining the metrics of text elements. The LaTeX environment can be modified by setting fonts and/or a custom preamble in rcParams. get_width_height_descent(text, prop)[source] Get the width, total height, and descent (in TeX points) for a text typeset by the current LaTeX environment. propertystr_cache[source] classmatplotlib.backends.backend_pgf.PdfPages(filename, *, keep_empty=True, metadata=None)[source] Bases: object A multi-page PDF file using the pgf backend Examples >>> import matplotlib.pyplot as plt >>> # Initialize: >>> with PdfPages('foo.pdf') as pdf: ... # As many times as you like, create a figure fig and save it: ... fig = plt.figure() ... pdf.savefig(fig) ... # When no figure is specified the current figure is saved ... pdf.savefig() Create a new PdfPages object. Parameters filenamestr or path-like Plots using PdfPages.savefig will be written to a file at this location. Any older file with the same name is overwritten. keep_emptybool, default: True If set to False, then empty pdf files will be deleted automatically when closed. metadatadict, optional 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. Note that some versions of LaTeX engines may ignore the 'Producer' key and set it to themselves. close()[source] Finalize this object, running LaTeX in a temporary directory and moving the final pdf file to filename. get_pagecount()[source] Return the current number of pages in the multipage pdf file. keep_empty savefig(figure=None, **kwargs)[source] Save a Figure to this file as a new page. Any other keyword arguments are passed to savefig. Parameters figureFigure or int, default: the active figure The figure, or index of the figure, that is saved to the file. classmatplotlib.backends.backend_pgf.RendererPgf(figure, fh)[source] Bases: matplotlib.backend_bases.RendererBase Create a new PGF renderer that translates any drawing instruction into text commands to be interpreted in a latex pgfpicture environment. Attributes figurematplotlib.figure.Figure Matplotlib figure to initialize height, width and dpi from. fhfile-like File handle for the output of the drawing commands. draw_image(gc, x, y, im, transform=None)[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, trans, 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_tex(gc, x, y, s, prop, angle, ismath='TeX', 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. flipy()[source] Return whether y values increase from top to bottom. Note that this only affects drawing of texts and images. 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. 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 classmatplotlib.backends.backend_pgf.TmpDirCleaner(*args, **kwargs)[source] Bases: object [Deprecated] Notes Deprecated since version 3.4: staticadd(tmpdir)[source] [Deprecated] Notes Deprecated since version 3.4: staticcleanup_remaining_tmpdirs()[source] [Deprecated] Notes Deprecated since version 3.4: remaining_tmpdirs={} matplotlib.backends.backend_pgf.common_texification(text)[source] Do some necessary and/or useful substitutions for texts to be included in LaTeX documents. This distinguishes text-mode and math-mode by replacing the math separator $ with \(\displaystyle %s\). Escaped math separators (\$) are ignored. The following characters are escaped in text segments: _^$% matplotlib.backends.backend_pgf.get_fontspec()[source] Build fontspec preamble from rc. matplotlib.backends.backend_pgf.get_preamble()[source] Get LaTeX preamble from rc. matplotlib.backends.backend_pgf.make_pdf_to_png_converter()[source] Return a function that converts a pdf file to a png file. matplotlib.backends.backend_pgf.writeln(fh, line)[source]
matplotlib.backend_pgf_api
backend_ps A PostScript backend, which can produce both PostScript .ps and .eps. matplotlib.backends.backend_ps.FigureCanvas[source] alias of matplotlib.backends.backend_ps.FigureCanvasPS classmatplotlib.backends.backend_ps.FigureCanvasPS(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={'eps': 'Encapsulated Postscript', 'ps': 'Postscript'} 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_eps(outfile, *args, **kwargs)[source] print_ps(outfile, *args, **kwargs)[source] classmatplotlib.backends.backend_ps.GraphicsContextPS[source] Bases: matplotlib.backend_bases.GraphicsContextBase [Deprecated] Notes Deprecated since version 3.4: get_capstyle()[source] Return the CapStyle. get_joinstyle()[source] Return the JoinStyle. classmatplotlib.backends.backend_ps.PsBackendHelper[source] Bases: object classmatplotlib.backends.backend_ps.RendererPS(width, height, pswriter, imagedpi=72)[source] Bases: matplotlib.backends._backend_pdf_ps.RendererPDFPSBase The renderer handles all the drawing primitives using a graphics context instance that controls the colors/styles. create_hatch(hatch)[source] draw_gouraud_triangle(gc, points, colors, trans)[source] Draw a Gouraud-shaded triangle. Parameters gcGraphicsContextBase The graphics context. points(3, 2) array-like Array of (x, y) points for the triangle. colors(3, 4) array-like RGBA colors for each point of the triangle. transformmatplotlib.transforms.Transform An affine transform to apply to the points. draw_gouraud_triangles(gc, points, colors, trans)[source] Draw a series of Gouraud triangles. Parameters points(N, 3, 2) array-like Array of N (x, y) points for the triangles. colors(N, 3, 4) array-like Array of N RGBA colors for each point of the triangles. transformmatplotlib.transforms.Transform An affine transform to apply to the points. draw_image(gc, x, y, im, transform=None)[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, trans, 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_mathtext(gc, x, y, s, prop, angle)[source] Draw the math text using matplotlib.mathtext. draw_path(gc, path, transform, rgbFace=None)[source] Draw a Path instance using the given affine transform. draw_path_collection(gc, master_transform, paths, all_transforms, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls, offset_position)[source] Draw a collection of paths selecting drawing properties from the lists facecolors, edgecolors, linewidths, linestyles and antialiaseds. offsets is a list of offsets to apply to each of the paths. The offsets in offsets are first transformed by offsetTrans before being applied. offset_position is unused now, but the argument is kept for backwards compatibility. This provides a fallback implementation of draw_path_collection() that makes multiple calls to draw_path(). Some backends may want to override this in order to render each set of path data only once, and then reference that path multiple times with the different offsets, colors, styles etc. The generator methods _iter_collection_raw_paths() and _iter_collection() are provided to help with (and standardize) the implementation across backends. It is highly recommended to use those generators, so that changes to the behavior of draw_path_collection() can be made globally. 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_image_magnification()[source] Get the factor by which to magnify images passed to draw_image. Allows a backend to have images at a different resolution to other artists. propertymathtext_parser[source] set_color(r, g, b, store=True)[source] set_font(fontname, fontsize, store=True)[source] set_linecap(linecap, store=True)[source] set_linedash(offset, seq, store=True)[source] set_linejoin(linejoin, store=True)[source] set_linewidth(linewidth, store=True)[source] matplotlib.backends.backend_ps.convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble, paper_width, paper_height, orientation)[source] When we want to use the LaTeX backend with postscript, we write PSFrag tags to a temporary postscript file, each one marking a position for LaTeX to render some text. convert_psfrags generates a LaTeX document containing the commands to convert those tags to text. LaTeX/dvips produces the postscript file that includes the actual text. matplotlib.backends.backend_ps.get_bbox_header(lbrt, rotated=False)[source] Return a postscript header string for the given bbox lbrt=(l, b, r, t). Optionally, return rotate command. matplotlib.backends.backend_ps.gs_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False)[source] Use ghostscript's pswrite or epswrite device to distill a file. This yields smaller files without illegal encapsulated postscript operators. The output is low-level, converting text to outlines. matplotlib.backends.backend_ps.pstoeps(tmpfile, bbox=None, rotated=False)[source] Convert the postscript to encapsulated postscript. The bbox of the eps file will be replaced with the given bbox argument. If None, original bbox will be used. matplotlib.backends.backend_ps.quote_ps_string(s)[source] Quote dangerous characters of S for use in a PostScript string constant. matplotlib.backends.backend_ps.xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False)[source] Use ghostscript's ps2pdf and xpdf's/poppler's pdftops to distill a file. This yields smaller files without illegal encapsulated postscript operators. This distiller is preferred, generating high-level postscript output that treats text as text.
matplotlib.backend_ps_api
backend_svg matplotlib.backends.backend_svg.FigureCanvas[source] alias of matplotlib.backends.backend_svg.FigureCanvasSVG classmatplotlib.backends.backend_svg.FigureCanvasSVG(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={'svg': 'Scalable Vector Graphics', 'svgz': 'Scalable Vector Graphics'} 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_svg(filename, *args, dpi=<deprecated parameter>, bbox_inches_restore=None, metadata=None)[source] Parameters filenamestr or path-like or file-like Output target; if a string, a file will be opened for writing. metadatadict[str, Any], optional Metadata in the SVG file defined as key-value pairs of strings, datetimes, or lists of strings, e.g., {'Creator': 'My software', 'Contributor': ['Me', 'My Friend'], 'Title': 'Awesome'}. The standard keys and their value types are: str: 'Coverage', 'Description', 'Format', 'Identifier', 'Language', 'Relation', 'Source', 'Title', and 'Type'. str or list of str: 'Contributor', 'Creator', 'Keywords', 'Publisher', and 'Rights'. str, date, datetime, or tuple of same: 'Date'. If a non-str, then it will be formatted as ISO 8601. Values have been predefined for 'Creator', 'Date', 'Format', and 'Type'. They can be removed by setting them to None. Information is encoded as Dublin Core Metadata. print_svgz(filename, *args, **kwargs)[source] classmatplotlib.backends.backend_svg.RendererSVG(width, height, svgwriter, basename=None, image_dpi=72, *, metadata=None)[source] Bases: matplotlib.backend_bases.RendererBase close_group(s)[source] Close a grouping element with label s. Only used by the SVG renderer. draw_gouraud_triangle(gc, points, colors, trans)[source] Draw a Gouraud-shaded triangle. Parameters gcGraphicsContextBase The graphics context. points(3, 2) array-like Array of (x, y) points for the triangle. colors(3, 4) array-like RGBA colors for each point of the triangle. transformmatplotlib.transforms.Transform An affine transform to apply to the points. draw_gouraud_triangles(gc, triangles_array, colors_array, transform)[source] Draw a series of Gouraud triangles. Parameters points(N, 3, 2) array-like Array of N (x, y) points for the triangles. colors(N, 3, 4) array-like Array of N RGBA colors for each point of the triangles. transformmatplotlib.transforms.Transform An affine transform to apply to the points. draw_image(gc, x, y, im, transform=None)[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, trans, 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_path_collection(gc, master_transform, paths, all_transforms, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls, offset_position)[source] Draw a collection of paths selecting drawing properties from the lists facecolors, edgecolors, linewidths, linestyles and antialiaseds. offsets is a list of offsets to apply to each of the paths. The offsets in offsets are first transformed by offsetTrans before being applied. offset_position is unused now, but the argument is kept for backwards compatibility. This provides a fallback implementation of draw_path_collection() that makes multiple calls to draw_path(). Some backends may want to override this in order to render each set of path data only once, and then reference that path multiple times with the different offsets, colors, styles etc. The generator methods _iter_collection_raw_paths() and _iter_collection() are provided to help with (and standardize) the implementation across backends. It is highly recommended to use those generators, so that changes to the behavior of draw_path_collection() can be made globally. 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. finalize()[source] flipy()[source] Return whether y values increase from top to bottom. Note that this only affects drawing of texts and images. get_canvas_width_height()[source] Return the canvas width and height in display coords. get_image_magnification()[source] Get the factor by which to magnify images passed to draw_image(). Allows a backend to have images at a different resolution to other artists. 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] open_group(s, gid=None)[source] Open a grouping element with label s and gid (if set) as id. Only used by the SVG renderer. 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). classmatplotlib.backends.backend_svg.XMLWriter(file)[source] Bases: object Parameters filewritable text file-like object close(id)[source] Close open elements, up to (and including) the element identified by the given identifier. Parameters id Element identifier, as returned by the start() method. comment(comment)[source] Add a comment to the output stream. Parameters commentstr Comment text. data(text)[source] Add character data to the output stream. Parameters textstr Character data. element(tag, text=None, attrib={}, **extra)[source] Add an entire element. This is the same as calling start(), data(), and end() in sequence. The text argument can be omitted. end(tag=None, indent=True)[source] Close the current element (opened by the most recent call to start()). Parameters tag Element tag. If given, the tag must match the start tag. If omitted, the current element is closed. flush()[source] Flush the output stream. start(tag, attrib={}, **extra)[source] Open a new element. Attributes can be given as keyword arguments, or as a string/string dictionary. The method returns an opaque identifier that can be passed to the close() method, to close all open elements up to and including this one. Parameters tag Element tag. attrib Attribute dictionary. Alternatively, attributes can be given as keyword arguments. Returns An element identifier. matplotlib.backends.backend_svg.escape_attrib(s)[source] matplotlib.backends.backend_svg.escape_cdata(s)[source] matplotlib.backends.backend_svg.escape_comment(s)[source] matplotlib.backends.backend_svg.generate_css(attrib={})[source] matplotlib.backends.backend_svg.generate_transform(transform_list=[])[source] matplotlib.backends.backend_svg.short_float_fmt(x)[source] Create a short string representation of a float, which is %f formatting with trailing zeros and the decimal point removed.
matplotlib.backend_svg_api
backend_template A fully functional, do-nothing backend intended as a template for backend writers. It is fully functional in that you can select it as a backend e.g. with import matplotlib matplotlib.use("template") and your program will (should!) run without error, though no output is produced. This provides a starting point for backend writers; you can selectively implement drawing methods (draw_path, draw_image, etc.) and slowly see your figure come to life instead having to have a full blown implementation before getting any results. Copy this file to a directory outside of the Matplotlib source tree, somewhere where Python can import it (by adding the directory to your sys.path or by packaging it as a normal Python package); if the backend is importable as import my.backend you can then select it using import matplotlib matplotlib.use("module://my.backend") If your backend implements support for saving figures (i.e. has a print_xyz method), you can register it as the default handler for a given file type: from matplotlib.backend_bases import register_backend register_backend('xyz', 'my_backend', 'XYZ File Format') ... plt.savefig("figure.xyz") matplotlib.backends.backend_template.FigureCanvas[source] alias of matplotlib.backends.backend_template.FigureCanvasTemplate classmatplotlib.backends.backend_template.FigureCanvasTemplate(figure=None)[source] Bases: matplotlib.backend_bases.FigureCanvasBase The canvas the figure renders into. Calls the draw and print fig methods, creates the renderers, etc. Note: GUI templates will want to connect events for button presses, mouse movements and key presses to functions that call the base class methods button_press_event, button_release_event, motion_notify_event, key_press_event, and key_release_event. See the implementations of the interactive backends for examples. Attributes figurematplotlib.figure.Figure A high-level Figure instance draw()[source] Draw the figure using the renderer. 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={'eps': 'Encapsulated Postscript', 'foo': 'My magic Foo format', 'jpeg': 'Joint Photographic Experts Group', 'jpg': 'Joint Photographic Experts Group', 'pdf': 'Portable Document Format', 'pgf': 'PGF code for LaTeX', 'png': 'Portable Network Graphics', 'ps': 'Postscript', 'raw': 'Raw RGBA bitmap', 'rgba': 'Raw RGBA bitmap', 'svg': 'Scalable Vector Graphics', 'svgz': 'Scalable Vector Graphics', 'tif': 'Tagged Image File Format', 'tiff': 'Tagged Image File 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_foo(filename, *args, **kwargs)[source] Write out format foo. This method is normally called via Figure.savefig and FigureCanvasBase.print_figure, which take care of setting the figure facecolor, edgecolor, and dpi to the desired output values, and will restore them to the original values. Therefore, print_foo does not need to handle these settings. matplotlib.backends.backend_template.FigureManager[source] alias of matplotlib.backends.backend_template.FigureManagerTemplate classmatplotlib.backends.backend_template.FigureManagerTemplate(canvas, num)[source] Bases: matplotlib.backend_bases.FigureManagerBase Helper class for pyplot mode, wraps everything up into a neat bundle. For non-interactive backends, the base class is sufficient. classmatplotlib.backends.backend_template.GraphicsContextTemplate[source] Bases: matplotlib.backend_bases.GraphicsContextBase The graphics context provides the color, line styles, etc... See the cairo and postscript backends for examples of mapping the graphics context attributes (cap styles, join styles, line widths, colors) to a particular backend. In cairo this is done by wrapping a cairo.Context object and forwarding the appropriate calls to it using a dictionary mapping styles to gdk constants. In Postscript, all the work is done by the renderer, mapping line styles to postscript calls. If it's more appropriate to do the mapping at the renderer level (as in the postscript backend), you don't need to override any of the GC methods. If it's more appropriate to wrap an instance (as in the cairo backend) and do the mapping here, you'll need to override several of the setter methods. The base GraphicsContext stores colors as a RGB tuple on the unit interval, e.g., (0.5, 0.0, 1.0). You may need to map this to colors appropriate for your backend. classmatplotlib.backends.backend_template.RendererTemplate(dpi)[source] Bases: matplotlib.backend_bases.RendererBase The renderer handles drawing/rendering operations. This is a minimal do-nothing class that can be used to get started when writing a new backend. Refer to backend_bases.RendererBase for documentation of the methods. 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_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. flipy()[source] Return whether y values increase from top to bottom. Note that this only affects drawing of texts and images. 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 matplotlib.backends.backend_template.draw_if_interactive()[source] For image backends - is not required. For GUI backends - this should be overridden if drawing should be done in interactive python mode. matplotlib.backends.backend_template.new_figure_manager(num, *args, FigureClass=<class 'matplotlib.figure.Figure'>, **kwargs)[source] Create a new figure manager instance. matplotlib.backends.backend_template.new_figure_manager_given_figure(num, figure)[source] Create a new figure manager instance for the given figure. matplotlib.backends.backend_template.show(*, block=None)[source] For image backends - is not required. For GUI backends - show() is usually the last line of a pyplot script and tells the backend that it is time to draw. In interactive mode, this should do nothing.
matplotlib.backend_template_api
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_api
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_api#matplotlib.backend_tools.add_tools_to_container
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_api#matplotlib.backend_tools.add_tools_to_manager
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.AxisScaleBase
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).
matplotlib.backend_tools_api#matplotlib.backend_tools.AxisScaleBase.disable
enable(event)[source] Enable the toggle tool. trigger calls this method when toggled is False.
matplotlib.backend_tools_api#matplotlib.backend_tools.AxisScaleBase.enable
trigger(sender, event, data=None)[source] Calls enable or disable based on toggled value.
matplotlib.backend_tools_api#matplotlib.backend_tools.AxisScaleBase.trigger
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ConfigureSubplotsBase
description='Configure subplots' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ConfigureSubplotsBase.description
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_api#matplotlib.backend_tools.ConfigureSubplotsBase.image
matplotlib.backend_tools.cursors[source] alias of matplotlib.backend_tools.Cursors
matplotlib.backend_tools_api#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_api#matplotlib.backend_tools.Cursors
HAND=2[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.Cursors.HAND
MOVE=4[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.Cursors.MOVE
POINTER=1[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.Cursors.POINTER
RESIZE_HORIZONTAL=6[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.Cursors.RESIZE_HORIZONTAL
RESIZE_VERTICAL=7[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.Cursors.RESIZE_VERTICAL
SELECT_REGION=3[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.Cursors.SELECT_REGION
WAIT=5[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.Cursors.WAIT
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_api#matplotlib.backend_tools.default_toolbar_tools
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_api#matplotlib.backend_tools.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.
matplotlib.backend_tools_api#matplotlib.backend_tools.RubberbandBase
draw_rubberband(*data)[source] Draw rubberband. This method must get implemented per backend.
matplotlib.backend_tools_api#matplotlib.backend_tools.RubberbandBase.draw_rubberband
remove_rubberband()[source] Remove rubberband. This method should get implemented per backend.
matplotlib.backend_tools_api#matplotlib.backend_tools.RubberbandBase.remove_rubberband
trigger(sender, event, data)[source] Call draw_rubberband or remove_rubberband based on data.
matplotlib.backend_tools_api#matplotlib.backend_tools.RubberbandBase.trigger
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.SaveFigureBase
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.SaveFigureBase.default_keymap
description='Save the figure' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.SaveFigureBase.description
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.SaveFigureBase.image
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]
matplotlib.backend_tools_api#matplotlib.backend_tools.SetCursorBase
set_cursor(cursor)[source] [Deprecated] Set the cursor. Notes Deprecated since version 3.5.
matplotlib.backend_tools_api#matplotlib.backend_tools.SetCursorBase.set_cursor
set_figure(figure)[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.SetCursorBase.set_figure
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolBack
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolBack.default_keymap
description='Back to previous view' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolBack.description
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolBack.image
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_api#matplotlib.backend_tools.ToolBase
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolBase.default_keymap
description=None Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolBase.description
destroy()[source] Destroy the tool. This method is called by ToolManager.remove_tool.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolBase.destroy
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolBase.image
set_figure(figure)[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolBase.set_figure
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_api#matplotlib.backend_tools.ToolBase.trigger
matplotlib.backend_tools.ToolCopyToClipboard[source] alias of matplotlib.backend_tools.ToolCopyToClipboardBase
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolCopyToClipboard
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolCopyToClipboardBase
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolCopyToClipboardBase.default_keymap
description='Copy the canvas figure to clipboard' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolCopyToClipboardBase.description
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolCopyToClipboardBase.trigger
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]
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolCursorPosition
send_message(event)[source] Call matplotlib.backend_managers.ToolManager.message_event.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolCursorPosition.send_message
set_figure(figure)[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolCursorPosition.set_figure
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolForward
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolForward.default_keymap
description='Forward to next view' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolForward.description
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolForward.image
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolFullScreen
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolFullScreen.default_keymap
description='Toggle fullscreen mode' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolFullScreen.description
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).
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolFullScreen.disable
enable(event)[source] Enable the toggle tool. trigger calls this method when toggled is False.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolFullScreen.enable
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolGrid
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolGrid.default_keymap
description='Toggle major grids' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolGrid.description
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_api#matplotlib.backend_tools.ToolGrid.trigger
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolHelpBase
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolHelpBase.default_keymap
description='Print tool list, shortcuts and description' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolHelpBase.description
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'.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolHelpBase.format_shortcut
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolHelpBase.image