matplotlib.widgets.AxesWidget#

classmatplotlib.widgets.AxesWidget(ax)[source]#

Bases:Widget

Widget connected to a singleAxes.

To guarantee that the widget remains responsive and not garbage-collected,a reference to the object should be maintained by the user.

This is necessary because the callback registrymaintains only weak-refs to the functions, which are memberfunctions of the widget. If there are no references to the widgetobject it may be garbage collected which will disconnect the callbacks.

Attributes:
axAxes

The parent Axes for the widget.

canvasFigureCanvasBase

The parent figure canvas for the widget.

activebool

Is the widget active?

propertycanvas#
connect_event(event,callback)[source]#

Connect a callback function with an event.

This should be used in lieu offigure.canvas.mpl_connect since thisfunction stores callback ids for later clean up.

disconnect_events()[source]#

Disconnect all events created by this widget.

ignore(event)[source]#

Return whetherevent should be ignored.

This method should be called at the beginning of any event callback.

Examples usingmatplotlib.widgets.AxesWidget#

Lasso Demo

Lasso Demo

Annotated cursor

Annotated cursor

Buttons

Buttons

Check buttons

Check buttons

Cursor

Cursor

Select indices from a collection using polygon selector

Select indices from a collection using polygon selector

Polygon Selector

Polygon Selector

Radio Buttons

Radio Buttons

Radio Buttons Grid

Radio Buttons Grid

Image scaling using a RangeSlider

Image scaling using a RangeSlider

Rectangle and ellipse selectors

Rectangle and ellipse selectors

Slider

Slider

Snap sliders to discrete values

Snap sliders to discrete values

Span Selector

Span Selector

Textbox

Textbox