Skip to content

Commit d83e5c8

Browse files
Committing Feature Implementation for Issue 8088
1 parent a30354e commit d83e5c8

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ def __init__(self, fig,
680680
raise ValueError('Width and height specified must be non-negative')
681681
self._originalPosition = self._position.frozen()
682682
self.axes = self
683-
self._aspect = 'auto'
683+
self._aspect = None
684684
self._adjustable = 'box'
685685
self._anchor = 'C'
686686
self._stale_viewlims = dict.fromkeys(self._axis_names, False)
@@ -1656,9 +1656,12 @@ def get_aspect(self):
16561656
"""
16571657
Return the aspect ratio of the Axes scaling.
16581658
1659-
This is either "auto" or a float giving the ratio of y/x-scale.
1659+
This is either "auto", "equal" or a float giving the ratio of y/x-scale.
16601660
"""
1661-
return self._aspect
1661+
if self._aspect:
1662+
return self._aspect
1663+
aspect = mpl.rcParams['axes.aspect']
1664+
return aspect if aspect != 'equal' else 1
16621665

16631666
def set_aspect(self, aspect, adjustable=None, anchor=None, share=False):
16641667
"""

lib/matplotlib/mpl-data/matplotlibrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@
390390
#axes.labelpad: 4.0 # space between label and axis
391391
#axes.labelweight: normal # weight of the x and y labels
392392
#axes.labelcolor: black
393+
#axes.aspect: auto # {auto, equal} or a number
393394
#axes.axisbelow: line # draw axis gridlines and ticks:
394395
# - below patches (True)
395396
# - above patches but below lines ('line')

lib/matplotlib/mpl-data/stylelib/classic.mplstyle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ axes.labelsize : medium # fontsize of the x any y labels
185185
axes.labelpad : 5.0 # space between label and axis
186186
axes.labelweight : normal # weight of the x and y labels
187187
axes.labelcolor : k
188+
axes.aspect : auto # auto | equal | a number
188189
axes.axisbelow : False # whether axis gridlines and ticks are below
189190
# the axes elements (lines, text, etc)
190191

lib/matplotlib/rcsetup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,8 @@ def _convert_validator_spec(key, conv):
11081108
"axes.spines.bottom": validate_bool, # denoting data boundary.
11091109
"axes.spines.top": validate_bool,
11101110

1111+
"axes.aspect": validate_aspect, # auto, equal, a number
1112+
11111113
"axes.titlesize": validate_fontsize, # Axes title fontsize
11121114
"axes.titlelocation": ["left", "center", "right"], # Axes title alignment
11131115
"axes.titleweight": validate_fontweight, # Axes title font weight

0 commit comments

Comments
 (0)