Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1d02de7

Browse files
committed
Improve documentation, docstring and comments
1 parent 326c064 commit 1d02de7

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Selector widget state internals
22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3-
*state_modifier_keys* have to be defined when creating the selector widget. The
4-
*state_modifier_keys* attribute is deprecated.
3+
*state_modifier_keys* now have to be defined when creating a selector widget.
4+
The *state_modifier_keys* attribute is deprecated.

doc/users/next_whats_new/rectangleselector_square_center.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ Rectangle selector square shape and centering
22
---------------------------------------------
33

44
When changing an existing `~matplotlib.widgets.RectangleSelector` interactively,
5-
the shape can now be kept square or changed around its center. The square shape
6-
can be defined in data or figure coordinates as determined by the
7-
``data_coordinates`` modifier.
5+
the shape can now be kept square or rotated/resized around its center.
6+
The square shape can be defined in data or display coordinate system as defined
7+
by the *data_coordinates* modifier.

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8096,7 +8096,10 @@ def violin(self, vpstats, positions=None, vert=True, widths=0.5,
80968096
triplot = mtri.triplot
80978097

80988098
def _get_aspect_ratio(self):
8099-
"""Convenience method to calculate aspect ratio of the axes."""
8099+
"""
8100+
Convenience method to calculate the aspect ratio of the axes in
8101+
the display coordinate system.
8102+
"""
81008103
figure_size = self.get_figure().get_size_inches()
81018104
ll, ur = self.get_position() * figure_size
81028105
width, height = ur - ll

lib/matplotlib/patches.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,10 @@ def __init__(self, xy, width, height, angle=0.0,
738738
self.angle = float(angle)
739739
self.rotate_around_center = rotate_around_center
740740
# Required for RectangleSelector with axes aspect ratio != 1
741+
# The patch is defined in data coordinates and when changing the
742+
# selector with square modifier and not in data coordinates, we need
743+
# to correct for the aspect ratio difference between the data and
744+
# display coordinate systems.
741745
self._aspect_ratio_correction = 1.0
742746
self._convert_units() # Validate the inputs.
743747

0 commit comments

Comments
 (0)