| [ Web Proxy ] |
| Viewing: https://matplotlib.org/devdocs/api/toolkits/../_as_gen/matplotlib.widgets.RectangleSelector.html | [Back] [Original] |
Section Navigation
matplotlibmatplotlib.animationmatplotlib.artistmatplotlib.axesmatplotlib.axismatplotlib.backend_basesmatplotlib.backend_managersmatplotlib.backend_toolsmatplotlib.backendsmatplotlib.backends.backend_mixedmatplotlib.backends.backend_templatematplotlib.backends.backend_aggmatplotlib.backends.backend_cairomatplotlib.backends.backend_gtk3agg, matplotlib.backends.backend_gtk3cairomatplotlib.backends.backend_gtk4agg, matplotlib.backends.backend_gtk4cairomatplotlib.backends.backend_nbaggmatplotlib.backends.backend_pdfmatplotlib.backends.backend_pgfmatplotlib.backends.backend_psmatplotlib.backends.registrymatplotlib.backends.backend_qtagg, matplotlib.backends.backend_qtcairomatplotlib.backends.backend_svgmatplotlib.backends.backend_tkagg, matplotlib.backends.backend_tkcairomatplotlib.backends.backend_webagg_corematplotlib.backends.backend_webaggmatplotlib.backends.backend_wxagg, matplotlib.backends.backend_wxcairomatplotlib.beziermatplotlib.categorymatplotlib.cbookmatplotlib.cmmatplotlib.collectionsmatplotlib.colorbarmatplotlib.colorizermatplotlib.colorsmatplotlib.containermatplotlib.contourmatplotlib.datesmatplotlib.dvireadmatplotlib.figurematplotlib.font_managermatplotlib.ft2fontmatplotlib.gridspec
matplotlib.hatchmatplotlib.imagematplotlib.insetmatplotlib.layout_enginematplotlib.legendmatplotlib.legend_handlermatplotlib.lines
matplotlib.markers
matplotlib.mathtextmatplotlib.mlabmatplotlib.offsetboxmatplotlib.patchesmatplotlib.pathmatplotlib.patheffectsmatplotlib.pyplotmatplotlib.projections
matplotlib.quiver
matplotlib.rcsetupmatplotlib.sankeymatplotlib.scalematplotlib.sphinxext.mathmplmatplotlib.sphinxext.plot_directivematplotlib.sphinxext.figmpl_directivematplotlib.sphinxext.rolesmatplotlib.spinesmatplotlib.stylematplotlib.tablematplotlib.testingmatplotlib.textmatplotlib.texmanagermatplotlib.tickermatplotlib.transformsmatplotlib.trimatplotlib.typingmatplotlib.unitsmatplotlib.widgetsmatplotlib._afmmatplotlib._apimatplotlib._docstringmatplotlib._enumsmatplotlib._type1fontmatplotlib._tight_bboxmatplotlib._tight_layoutmpl_toolkits.mplot3dmpl_toolkits.axes_grid1mpl_toolkits.axisartistpylabmatplotlib.widgetsBases: _SelectorWidget
Select a rectangular region of an Axes.
For the cursor to remain responsive you must keep a reference to it.
Press and release events triggered at the same coordinates outside the
selection will clear the selector, except when
ignore_event_outside=True.
AxesThe parent Axes for the widget.
A callback function that is called after a release event and the selection is created, changed or removed. It must have the signature:
def onselect(eclick: MouseEvent, erelease: MouseEvent)
where eclick and erelease are the mouse click and release
MouseEvents that start and complete the selection.
Selections with an x-span less than or equal to minspanx are removed (when already existing) or cancelled.
Selections with a y-span less than or equal to minspanx are removed (when already existing) or cancelled.
Whether to use blitting for faster drawing (if supported by the backend). See the tutorial Faster rendering by using blitting for details.
Properties with which the rectangle is drawn. See
Patch for valid properties.
Default:
dict(facecolor='red', edgecolor='black', alpha=0.2, fill=True)
Whether to interpret minspanx and minspany in data or in pixel coordinates.
MouseButton, list of MouseButton, default: all buttonsButton(s) that trigger rectangle selection.
Distance in pixels within which the interactive tool handles can be activated.
Properties with which the interactive handles (marker artists) are
drawn. See the marker arguments in Line2D for valid
properties. Default values are defined in mpl.rcParams except for
the default value of markeredgecolor which will be the same as the
edgecolor property in props.
Whether to draw a set of handles that allow interaction with the widget after it is drawn.
Keyboard modifiers which affect the widget's behavior. Values amend the defaults, which are:
"move": Move the existing shape, default: no modifier.
"clear": Clear the current shape, default: "escape".
"square": Make the shape square, default: "shift".
"center": change the shape around its center, default: "ctrl".
"rotate": Rotate the shape around its center between -45 and 45, default: "r".
"square" and "center" can be combined. The square shape can be defined
in data or display coordinates as determined by the
use_data_coordinates argument specified when creating the selector.
If True, the widget can be moved by clicking anywhere within
its bounds.
If True, the event triggered outside the span selector will be
ignored.
If True, the "square" shape of the selector is defined in
data coordinates instead of display coordinates.
Examples
>>> import matplotlib.pyplot as plt
>>> import matplotlib.widgets as mwidgets
>>> fig, ax = plt.subplots()
>>> ax.plot([1, 2, 3], [10, 50, 100])
>>> def onselect(eclick, erelease):
... print(eclick.xdata, eclick.ydata)
... print(erelease.xdata, erelease.ydata)
>>> props = dict(facecolor='blue', alpha=0.5)
>>> rect = mwidgets.RectangleSelector(ax, onselect, interactive=True,
... props=props)
>>> fig.show()
>>> rect.add_state('square')
See also: Rectangle and ellipse selectors
Center of rectangle in data coordinates.
Corners of rectangle in data coordinates from lower left, moving clockwise.
Midpoint of rectangle edges in data coordinates from left, moving anti-clockwise.
Return (xmin, xmax, ymin, ymax) in data coordinates as defined by the bounding box before rotation.
Return an array of shape (2, 5) containing the
x (RectangleSelector.geometry[1, :]) and
y (RectangleSelector.geometry[0, :]) data coordinates of the four
corners of the rectangle starting and ending in the top left corner.
Rotation in degree in interval [-45, 45]. The rotation is limited in range to keep the implementation simple.
matplotlib.widgets.RectangleSelector#
Copyright 20022012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 20122026 The Matplotlib development team.
Created using Sphinx 9.1.0.
Built from v3.11.2-738-ge3fc0dad9.
Built with the PyData Sphinx Theme 0.18.0.
| Web Proxy Viewer | New URL | Original Page |