doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolHome
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolHome.default_keymap
description='Reset original view' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolHome.description
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolHome.image
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolMinorGrid
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.ToolMinorGrid.default_keymap
description='Toggle major and minor grids' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolMinorGrid.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.ToolMinorGrid.trigger
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolPan
cursor=4[source] Cursor to use when the tool is active.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolPan.cursor
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolPan.default_keymap
description='Pan axes with left mouse, zoom with right' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolPan.description
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolPan.image
radio_group='default' Attribute to group 'radio' like tools (mutually exclusive). str that identifies the group or None if not belonging to a group.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolPan.radio_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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolQuit
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolQuit.default_keymap
description='Quit the figure' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolQuit.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.ToolQuit.trigger
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_api#matplotlib.backend_tools.ToolQuitAll
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolQuitAll.default_keymap
description='Quit all figures' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolQuitAll.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.ToolQuitAll.trigger
matplotlib.backend_tools.ToolSetCursor[source] alias of matplotlib.backend_tools.SetCursorBase
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolSetCursor
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolToggleBase
cursor=None Cursor to use when the tool is active.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolToggleBase.cursor
default_toggled=False Default of toggled state.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolToggleBase.default_toggled
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).
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolToggleBase.disable
enable(event=None)[source] Enable the toggle tool. trigger calls this method when toggled is False.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolToggleBase.enable
radio_group=None Attribute to group 'radio' like tools (mutually exclusive). str that identifies the group or None if not belonging to a group.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolToggleBase.radio_group
set_figure(figure)[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolToggleBase.set_figure
trigger(sender, event, data=None)[source] Calls enable or disable based on toggled value.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolToggleBase.trigger
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolViewsPositions
add_figure(figure)[source] Add the current figure to the stack of views and positions.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolViewsPositions.add_figure
back()[source] Back one step in the stack of views and positions.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolViewsPositions.back
clear(figure)[source] Reset the axes stack.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolViewsPositions.clear
forward()[source] Forward one step in the stack of views and positions.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolViewsPositions.forward
home()[source] Recall the first view and position from the stack.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolViewsPositions.home
push_current(figure=None)[source] Push the current view limits and position onto their respective stacks.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolViewsPositions.push_current
update_home_views(figure=None)[source] Make sure that self.home_views has an entry for all axes present in the figure.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolViewsPositions.update_home_views
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolViewsPositions.update_view
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]
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolXScale
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolXScale.default_keymap
description='Toggle scale X axis' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolXScale.description
set_scale(ax, scale)[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolXScale.set_scale
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]
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolYScale
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolYScale.default_keymap
description='Toggle scale Y axis' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolYScale.description
set_scale(ax, scale)[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolYScale.set_scale
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolZoom
cursor=3[source] Cursor to use when the tool is active.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolZoom.cursor
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolZoom.default_keymap
description='Zoom to rectangle' Description of the Tool. str: Tooltip used if the Tool is included in a Toolbar.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolZoom.description
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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolZoom.image
radio_group='default' Attribute to group 'radio' like tools (mutually exclusive). str that identifies the group or None if not belonging to a group.
matplotlib.backend_tools_api#matplotlib.backend_tools.ToolZoom.radio_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.
matplotlib.backend_tools_api#matplotlib.backend_tools.ViewsPositionsBase
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.ViewsPositionsBase.trigger
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_api#matplotlib.backend_tools.ZoomPanBase
disable(event)[source] Release the canvas and disconnect press/release events.
matplotlib.backend_tools_api#matplotlib.backend_tools.ZoomPanBase.disable
enable(event)[source] Connect press/release events and lock the canvas.
matplotlib.backend_tools_api#matplotlib.backend_tools.ZoomPanBase.enable
scroll_zoom(event)[source]
matplotlib.backend_tools_api#matplotlib.backend_tools.ZoomPanBase.scroll_zoom
trigger(sender, event, data=None)[source] Calls enable or disable based on toggled value.
matplotlib.backend_tools_api#matplotlib.backend_tools.ZoomPanBase.trigger
backend_webagg Displays Agg images in the browser, with interactivity matplotlib.backends.backend_webagg.FigureCanvas[source] alias of matplotlib.backends.backend_webagg.FigureCanvasWebAgg classmatplotlib.backends.backend_webagg.FigureCanvasWebAgg(*args, **kwargs)[source] Bases: matplotlib.backends.backend_webagg_core.FigureCanvasWebAggCore classmatplotlib.backends.backend_webagg.ServerThread(group=None, target=None, name=None, args=(), kwargs=None, *, daemon=None)[source] Bases: threading.Thread This constructor should always be called with keyword arguments. Arguments are: group should be None; reserved for future extension when a ThreadGroup class is implemented. target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called. name is the thread name. By default, a unique name is constructed of the form "Thread-N" where N is a small decimal number. args is the argument tuple for the target invocation. Defaults to (). kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}. If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread. run()[source] Method representing the thread's activity. You may override this method in a subclass. The standard run() method invokes the callable object passed to the object's constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively. classmatplotlib.backends.backend_webagg.WebAggApplication(url_prefix='')[source] Bases: tornado.web.Application classAllFiguresPage(application, request, *, url_prefix='', **kwargs)[source] Bases: tornado.web.RequestHandler get()[source] classDownload(application:tornado.web.Application, request:tornado.httputil.HTTPServerRequest, **kwargs:Any)[source] Bases: tornado.web.RequestHandler get(fignum, fmt)[source] classFavIcon(application:tornado.web.Application, request:tornado.httputil.HTTPServerRequest, **kwargs:Any)[source] Bases: tornado.web.RequestHandler get()[source] classMplJs(application:tornado.web.Application, request:tornado.httputil.HTTPServerRequest, **kwargs:Any)[source] Bases: tornado.web.RequestHandler get()[source] classSingleFigurePage(application, request, *, url_prefix='', **kwargs)[source] Bases: tornado.web.RequestHandler get(fignum)[source] classWebSocket(application:tornado.web.Application, request:tornado.httputil.HTTPServerRequest, **kwargs:Any)[source] Bases: tornado.websocket.WebSocketHandler on_close()[source] Invoked when the WebSocket is closed. If the connection was closed cleanly and a status code or reason phrase was supplied, these values will be available as the attributes self.close_code and self.close_reason. Changed in version 4.0: Added close_code and close_reason attributes. on_message(message)[source] Handle incoming messages on the WebSocket This method must be overridden. Changed in version 4.5: on_message can be a coroutine. open(fignum)[source] Invoked when a new WebSocket is opened. The arguments to open are extracted from the tornado.web.URLSpec regular expression, just like the arguments to tornado.web.RequestHandler.get. open may be a coroutine. on_message will not be called until open has returned. Changed in version 5.1: open may be a coroutine. send_binary(blob)[source] send_json(content)[source] supports_binary=True classmethodinitialize(url_prefix='', port=None, address=None)[source] initialized=False classmethodstart()[source] started=False matplotlib.backends.backend_webagg.ipython_inline_display(figure)[source] matplotlib.backends.backend_webagg.show()[source] Show all figures. show blocks by calling mainloop if block is True, or if it is None and we are neither in IPython's %pylab mode, nor in interactive mode.
matplotlib.backend_webagg_api
matplotlib.backends backend_mixed backend_template backend_agg backend_cairo backend_gtk3agg, backend_gtk3cairo backend_gtk4agg, backend_gtk4cairo backend_nbagg backend_pdf backend_pgf backend_ps backend_qtagg, backend_qtcairo backend_svg backend_tkagg, backend_tkcairo backend_webagg backend_wxagg, backend_wxcairo
matplotlib.index_backend_api
matplotlib.backends.backend_agg.FigureCanvas[source] alias of matplotlib.backends.backend_agg.FigureCanvasAgg
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvas
classmatplotlib.backends.backend_agg.FigureCanvasAgg(figure=None)[source] Bases: matplotlib.backend_bases.FigureCanvasBase buffer_rgba()[source] Get the image as a memoryview to the renderer's buffer. draw must be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure. copy_from_bbox(bbox)[source] draw()[source] Render the Figure. It is important that this method actually walk the artist tree even if not output is produced because this will trigger deferred work (like computing limits auto-limits and tick values) that users may want access to before saving to disk. get_renderer(cleared=False)[source] print_jpeg(filename_or_obj, *args, pil_kwargs=None, **kwargs)[source] Write the figure to a JPEG file. Parameters filename_or_objstr or path-like or file-like The file to write to. Other Parameters pil_kwargsdict, optional Additional keyword arguments that are passed to PIL.Image.Image.save when saving the figure. print_jpg(filename_or_obj, *args, pil_kwargs=None, **kwargs)[source] Write the figure to a JPEG file. Parameters filename_or_objstr or path-like or file-like The file to write to. Other Parameters pil_kwargsdict, optional Additional keyword arguments that are passed to PIL.Image.Image.save when saving the figure. print_png(filename_or_obj, *args, metadata=None, pil_kwargs=None)[source] Write the figure to a PNG file. Parameters filename_or_objstr or path-like or file-like The file to write to. metadatadict, optional Metadata in the PNG file as key-value pairs of bytes or latin-1 encodable strings. According to the PNG specification, keys must be shorter than 79 chars. The PNG specification defines some common keywords that may be used as appropriate: Title: Short (one line) title or caption for image. Author: Name of image's creator. Description: Description of image (possibly long). Copyright: Copyright notice. Creation Time: Time of original image creation (usually RFC 1123 format). Software: Software used to create the image. Disclaimer: Legal disclaimer. Warning: Warning of nature of content. Source: Device used to create the image. Comment: Miscellaneous comment; conversion from other image format. Other keywords may be invented for other purposes. If 'Software' is not given, an autogenerated value for Matplotlib will be used. This can be removed by setting it to None. For more details see the PNG specification. pil_kwargsdict, optional Keyword arguments passed to PIL.Image.Image.save. If the 'pnginfo' key is present, it completely overrides metadata, including the default 'Software' key. print_raw(filename_or_obj, *args)[source] print_rgba(filename_or_obj, *args)[source] print_tif(filename_or_obj, *, pil_kwargs=None)[source] print_tiff(filename_or_obj, *, pil_kwargs=None)[source] print_to_buffer()[source] restore_region(region, bbox=None, xy=None)[source] tostring_argb()[source] Get the image as ARGB bytes. draw must be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure. tostring_rgb()[source] Get the image as RGB bytes. draw must be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg
buffer_rgba()[source] Get the image as a memoryview to the renderer's buffer. draw must be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.buffer_rgba
copy_from_bbox(bbox)[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.copy_from_bbox
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.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.draw
get_renderer(cleared=False)[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.get_renderer
print_jpeg(filename_or_obj, *args, pil_kwargs=None, **kwargs)[source] Write the figure to a JPEG file. Parameters filename_or_objstr or path-like or file-like The file to write to. Other Parameters pil_kwargsdict, optional Additional keyword arguments that are passed to PIL.Image.Image.save when saving the figure.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.print_jpeg
print_jpg(filename_or_obj, *args, pil_kwargs=None, **kwargs)[source] Write the figure to a JPEG file. Parameters filename_or_objstr or path-like or file-like The file to write to. Other Parameters pil_kwargsdict, optional Additional keyword arguments that are passed to PIL.Image.Image.save when saving the figure.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.print_jpg
print_png(filename_or_obj, *args, metadata=None, pil_kwargs=None)[source] Write the figure to a PNG file. Parameters filename_or_objstr or path-like or file-like The file to write to. metadatadict, optional Metadata in the PNG file as key-value pairs of bytes or latin-1 encodable strings. According to the PNG specification, keys must be shorter than 79 chars. The PNG specification defines some common keywords that may be used as appropriate: Title: Short (one line) title or caption for image. Author: Name of image's creator. Description: Description of image (possibly long). Copyright: Copyright notice. Creation Time: Time of original image creation (usually RFC 1123 format). Software: Software used to create the image. Disclaimer: Legal disclaimer. Warning: Warning of nature of content. Source: Device used to create the image. Comment: Miscellaneous comment; conversion from other image format. Other keywords may be invented for other purposes. If 'Software' is not given, an autogenerated value for Matplotlib will be used. This can be removed by setting it to None. For more details see the PNG specification. pil_kwargsdict, optional Keyword arguments passed to PIL.Image.Image.save. If the 'pnginfo' key is present, it completely overrides metadata, including the default 'Software' key.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.print_png
print_raw(filename_or_obj, *args)[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.print_raw
print_rgba(filename_or_obj, *args)[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.print_rgba
print_tif(filename_or_obj, *, pil_kwargs=None)[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.print_tif
print_tiff(filename_or_obj, *, pil_kwargs=None)[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.print_tiff
print_to_buffer()[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.print_to_buffer
restore_region(region, bbox=None, xy=None)[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.restore_region
tostring_argb()[source] Get the image as ARGB bytes. draw must be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.tostring_argb
tostring_rgb()[source] Get the image as RGB bytes. draw must be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.FigureCanvasAgg.tostring_rgb
matplotlib.backends.backend_agg.get_hinting_flag()[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.get_hinting_flag
classmatplotlib.backends.backend_agg.RendererAgg(width, height, dpi)[source] Bases: matplotlib.backend_bases.RendererBase The renderer handles all the drawing primitives using a graphics context instance that controls the colors/styles buffer_rgba()[source] clear()[source] draw_mathtext(gc, x, y, s, prop, angle)[source] Draw mathtext using matplotlib.mathtext. draw_path(gc, path, transform, rgbFace=None)[source] Draw a Path instance using the given affine transform. draw_tex(gc, x, y, s, prop, angle, *, mtext=None)[source] draw_text(gc, x, y, s, prop, angle, ismath=False, mtext=None)[source] Draw the text instance. Parameters gcGraphicsContextBase The graphics context. xfloat The x location of the text in display coords. yfloat The y location of the text baseline in display coords. sstr The text string. propmatplotlib.font_manager.FontProperties The font properties. anglefloat The rotation angle in degrees anti-clockwise. mtextmatplotlib.text.Text The original text object to be rendered. Notes Note for backend implementers: When you are trying to determine if you have gotten your bounding box right (which is what enables the text layout/alignment to work properly), it helps to change the line in text.py: if 0: bbox_artist(self, renderer) to if 1, and then the actual bounding box will be plotted along with your text. get_canvas_width_height()[source] Return the canvas width and height in display coords. get_content_extents()[source] [Deprecated] Notes Deprecated since version 3.4: get_text_width_height_descent(s, prop, ismath)[source] Get the width, height, and descent (offset from the bottom to the baseline), in display coords, of the string s with FontProperties prop. lock=<unlocked _thread.RLock object owner=0 count=0> option_image_nocomposite()[source] Return whether image composition by Matplotlib should be skipped. Raster backends should usually return False (letting the C-level rasterizer take care of image composition); vector backends should usually return not rcParams["image.composite_image"]. option_scale_image()[source] Return whether arbitrary affine transformations in draw_image() are supported (True for most vector backends). points_to_pixels(points)[source] Convert points to display units. You need to override this function (unless your backend doesn't have a dpi, e.g., postscript or svg). Some imaging systems assume some value for pixels per inch: points to pixels = points * pixels_per_inch/72 * dpi/72 Parameters pointsfloat or array-like a float or a numpy array of float Returns Points converted to pixels restore_region(region, bbox=None, xy=None)[source] Restore the saved region. If bbox (instance of BboxBase, or its extents) is given, only the region specified by the bbox will be restored. xy (a pair of floats) optionally specifies the new position (the LLC of the original region, not the LLC of the bbox) where the region will be restored. >>> region = renderer.copy_from_bbox() >>> x1, y1, x2, y2 = region.get_extents() >>> renderer.restore_region(region, bbox=(x1+dx, y1, x2, y2), ... xy=(x1-dx, y1)) start_filter()[source] Start filtering. It simply create a new canvas (the old one is saved). stop_filter(post_processing)[source] Save the plot in the current canvas as a image and apply the post_processing function. def post_processing(image, dpi): # ny, nx, depth = image.shape # image (numpy array) has RGBA channels and has a depth of 4. ... # create a new_image (numpy array of 4 channels, size can be # different). The resulting image may have offsets from # lower-left corner of the original image return new_image, offset_x, offset_y The saved renderer is restored and the returned image from post_processing is plotted (using draw_image) on it. tostring_argb()[source] tostring_rgb()[source] tostring_rgba_minimized()[source] [Deprecated] Notes Deprecated since version 3.4:
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg
buffer_rgba()[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.buffer_rgba
clear()[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.clear
draw_mathtext(gc, x, y, s, prop, angle)[source] Draw mathtext using matplotlib.mathtext.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.draw_mathtext
draw_path(gc, path, transform, rgbFace=None)[source] Draw a Path instance using the given affine transform.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.draw_path
draw_tex(gc, x, y, s, prop, angle, *, mtext=None)[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.draw_tex
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.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.draw_text
get_canvas_width_height()[source] Return the canvas width and height in display coords.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.get_canvas_width_height
get_content_extents()[source] [Deprecated] Notes Deprecated since version 3.4:
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.get_content_extents
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.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.get_text_width_height_descent
lock=<unlocked _thread.RLock object owner=0 count=0>
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.lock
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"].
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.option_image_nocomposite
option_scale_image()[source] Return whether arbitrary affine transformations in draw_image() are supported (True for most vector backends).
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.option_scale_image
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.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.points_to_pixels
restore_region(region, bbox=None, xy=None)[source] Restore the saved region. If bbox (instance of BboxBase, or its extents) is given, only the region specified by the bbox will be restored. xy (a pair of floats) optionally specifies the new position (the LLC of the original region, not the LLC of the bbox) where the region will be restored. >>> region = renderer.copy_from_bbox() >>> x1, y1, x2, y2 = region.get_extents() >>> renderer.restore_region(region, bbox=(x1+dx, y1, x2, y2), ... xy=(x1-dx, y1))
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.restore_region
start_filter()[source] Start filtering. It simply create a new canvas (the old one is saved).
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.start_filter
stop_filter(post_processing)[source] Save the plot in the current canvas as a image and apply the post_processing function. def post_processing(image, dpi): # ny, nx, depth = image.shape # image (numpy array) has RGBA channels and has a depth of 4. ... # create a new_image (numpy array of 4 channels, size can be # different). The resulting image may have offsets from # lower-left corner of the original image return new_image, offset_x, offset_y The saved renderer is restored and the returned image from post_processing is plotted (using draw_image) on it.
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.stop_filter
tostring_argb()[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.tostring_argb
tostring_rgb()[source]
matplotlib.backend_agg_api#matplotlib.backends.backend_agg.RendererAgg.tostring_rgb