diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 15f8e97b449f..fc97d511a8a0 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -680,8 +680,8 @@ def __init__(self, fig, raise ValueError('Width and height specified must be non-negative') self._originalPosition = self._position.frozen() self.axes = self - self._aspect = 'auto' - self._adjustable = 'box' + self._aspect = mpl.rcParams['axes.aspect'] + self._adjustable = mpl.rcParams['axes.adjustable'] self._anchor = 'C' self._stale_viewlims = dict.fromkeys(self._axis_names, False) self._forward_navigation_events = forward_navigation_events diff --git a/lib/matplotlib/mpl-data/matplotlibrc b/lib/matplotlib/mpl-data/matplotlibrc index acb131c82e6c..e5c5377fd1e5 100644 --- a/lib/matplotlib/mpl-data/matplotlibrc +++ b/lib/matplotlib/mpl-data/matplotlibrc @@ -390,6 +390,8 @@ #axes.labelpad: 4.0 # space between label and axis #axes.labelweight: normal # weight of the x and y labels #axes.labelcolor: black +#axes.aspect: auto # {auto, equal} or a number +#axes.adjustable: box # box or datalim #axes.axisbelow: line # draw axis gridlines and ticks: # - below patches (True) # - above patches but below lines ('line') diff --git a/lib/matplotlib/mpl-data/stylelib/classic.mplstyle b/lib/matplotlib/mpl-data/stylelib/classic.mplstyle index 6cba66076ac7..002f555cbcca 100644 --- a/lib/matplotlib/mpl-data/stylelib/classic.mplstyle +++ b/lib/matplotlib/mpl-data/stylelib/classic.mplstyle @@ -185,6 +185,8 @@ axes.labelsize : medium # fontsize of the x any y labels axes.labelpad : 5.0 # space between label and axis axes.labelweight : normal # weight of the x and y labels axes.labelcolor : k +axes.aspect : auto # auto | equal | a number +axes.adjustable : box # box | datalim axes.axisbelow : False # whether axis gridlines and ticks are below # the axes elements (lines, text, etc) diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index ce29c5076100..d880d2804b56 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -397,8 +397,10 @@ def _validate_cmap(s): def validate_aspect(s): - if s in ('auto', 'equal'): + if s == 'auto': return s + if s == 'equal': + return 1 try: return float(s) except ValueError as e: @@ -1108,6 +1110,9 @@ def _convert_validator_spec(key, conv): "axes.spines.bottom": validate_bool, # denoting data boundary. "axes.spines.top": validate_bool, + "axes.aspect": validate_aspect, # auto, equal, a number + "axes.adjustable": ["box", "datalim"], + "axes.titlesize": validate_fontsize, # Axes title fontsize "axes.titlelocation": ["left", "center", "right"], # Axes title alignment "axes.titleweight": validate_fontweight, # Axes title font weight