matplotlib.backends.backend_webagg_core#

Displays Agg images in the browser, with interactivity.

matplotlib.backends.backend_webagg_core.FigureCanvas[source]#

alias ofFigureCanvasWebAggCore

classmatplotlib.backends.backend_webagg_core.FigureCanvasWebAggCore(*args,**kwargs)[source]#

Bases:FigureCanvasAgg

blit(bbox=None)[source]#

Blit the canvas in bbox (default entire canvas).

draw()[source]#

Render theFigure.

This method must walk the artist tree, even if no output is produced,because it triggers deferred work that users may want to accessbefore saving output to disk. For example computing limits,auto-limits, and tick values.

draw_idle()[source]#

Request a widget redraw once control returns to the GUI event loop.

Even if multiple calls todraw_idle occur before control returnsto the GUI event loop, the figure will only be rendered once.

Notes

Backends may choose to override the method and implement their ownstrategy to prevent multiple renderings.

get_diff_image()[source]#
handle_ack(event)[source]#
handle_button_press(event)[source]#
handle_button_release(event)[source]#
handle_dblclick(event)[source]#
handle_draw(event)[source]#
handle_event(event)[source]#
handle_figure_enter(event)[source]#
handle_figure_leave(event)[source]#
handle_key_press(event)[source]#
handle_key_release(event)[source]#
handle_motion_notify(event)[source]#
handle_refresh(event)[source]#
handle_resize(event)[source]#
handle_scroll(event)[source]#
handle_send_image_mode(event)[source]#
handle_set_device_pixel_ratio(event)[source]#
handle_set_dpi_ratio(event)[source]#
handle_toolbar_button(event)[source]#
handle_unknown_event(event)[source]#
manager_class[source]#

alias ofFigureManagerWebAgg

send_event(event_type,**kwargs)[source]#
set_cursor(cursor)[source]#

Set the current cursor.

This may have no effect if the backend does not display anything.

If required by the backend, this method should trigger an update inthe backend event loop after the cursor is set, as this method may becalled e.g. before a long-running task during which the GUI is notupdated.

Parameters:
cursorCursors

The cursor to display over the canvas. Note: some backends maychange the cursor for the entire window.

set_image_mode(mode)[source]#

Set the image mode for any subsequent images which will be sentto the clients. The modes may currently be either 'full' or 'diff'.

Note: diff images may not contain transparency, therefore upondraw this mode may be changed if the resulting image has anytransparent component.

show()[source]#
supports_blit=False#
matplotlib.backends.backend_webagg_core.FigureManager[source]#

alias ofFigureManagerWebAgg

classmatplotlib.backends.backend_webagg_core.FigureManagerWebAgg(canvas,num)[source]#

Bases:FigureManagerBase

ToolbarCls[source]#

alias ofNavigationToolbar2WebAgg

add_web_socket(web_socket)[source]#
classmethodget_javascript(stream=None)[source]#
classmethodget_static_file_path()[source]#
get_window_title()[source]#

Return the title text of the window containing the figure.

handle_json(content)[source]#
refresh_all()[source]#
remove_web_socket(web_socket)[source]#
resize(w,h,forward=True)[source]#

For GUI backends, resize the window (in physical pixels).

set_window_title(title)[source]#

Set the title text of the window containing the figure.

Examples

>>>fig=plt.figure()>>>fig.canvas.manager.set_window_title('My figure')
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 awarning inFigure.show.

classmatplotlib.backends.backend_webagg_core.NavigationToolbar2WebAgg(canvas)[source]#

Bases:NavigationToolbar2

draw_rubberband(event,x0,y0,x1,y1)[source]#

Draw a rectangle rubberband to indicate zoom limits.

Note that it is not guaranteed thatx0<=x1 andy0<=y1.

pan()[source]#

Toggle the pan/zoom tool.

Pan with left button, zoom with right.

remove_rubberband()[source]#

Remove the rubberband.

save_figure(*args)[source]#

Save the current figure.

set_history_buttons()[source]#

Enable or disable the back/forward button.

set_message(message)[source]#

Display a message on toolbar or in status bar.

toolitems=[('Home','Resetoriginalview','home','home'),('Back','Backtopreviousview','back','back'),('Forward','Forwardtonextview','forward','forward'),(None,None,None,None),('Pan','Leftbuttonpans,Rightbuttonzooms\nx/yfixesaxis,CTRLfixesaspect','move','pan'),('Zoom','Zoomtorectangle\nx/yfixesaxis','zoom_to_rect','zoom'),(None,None,None,None),('Download','Downloadplot','filesave','download')]#
zoom()[source]#
classmatplotlib.backends.backend_webagg_core.TimerAsyncio(*args,**kwargs)[source]#

Bases:TimerBase

Parameters:
intervalint, default: 1000ms

The time between timer events in milliseconds. Will be stored astimer.interval.

callbackslist[tuple[callable, tuple, dict]]

List of (func, args, kwargs) tuples that will be called upon timerevents. This list is accessible astimer.callbacks and can bemanipulated directly, or the functionsadd_callbackandremove_callback can be used.

classmatplotlib.backends.backend_webagg_core.TimerTornado(*args,**kwargs)[source]#

Bases:TimerBase

Parameters:
intervalint, default: 1000ms

The time between timer events in milliseconds. Will be stored astimer.interval.

callbackslist[tuple[callable, tuple, dict]]

List of (func, args, kwargs) tuples that will be called upon timerevents. This list is accessible astimer.callbacks and can bemanipulated directly, or the functionsadd_callbackandremove_callback can be used.

On this page