FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add `axes.aspect` as an option to rcParams by andrzejnovak · Pull Request #15001 · matplotlib/matplotlib · GitHub

Repository navigation

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) .rst  (1) .template  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 9 additions & 0 deletions doc/users/next_whats_new/rcparam-axes-aspect.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rcParams for default axes aspect
--------------------------------------------------

One new rcParams have been added: ``axes.aspect`` for the default axes.aspect specification

Valid values for ``axes.aspect`` remain: 'auto', 'equal' or a float.

Default behviour is unchanged.

2 changes: 1 addition & 1 deletion lib/matplotlib/axes/_base.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def __init__(self, fig, rect,
raise ValueError('Width and height specified must be non-negative')
self._originalPosition = self._position.frozen()
self.axes = self
self._aspect = 'auto'
self._aspect = rcParams['axes.aspect']
self._adjustable = 'box'
self._anchor = 'C'
self._stale_viewlim_x = False
Expand Down
8 changes: 6 additions & 2 deletions lib/matplotlib/rcsetup.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,15 @@ def validate_color(s):


def validate_aspect(s):
if s in ('auto', 'equal'):
aspect_specifications = ['auto', 'equal']
if s in aspect_specifications:
return s
try:
return float(s)
except ValueError:
raise ValueError('not a valid aspect specification')
raise ValueError(
"%s is not a valid aspect specification. Valid aspect "
"specifications are %s." % (s, ", ".join(aspect_specifications)))


def validate_fontsize_None(s):
Expand Down Expand Up @@ -1175,6 +1178,7 @@ def _validate_linestyle(ls):
'axes.autolimit_mode': [
'data',
ValidateInStrings('autolimit_mode', ['data', 'round_numbers'])],
'axes.aspect': ['auto', validate_aspect],
'axes.xmargin': [0.05, ValidateInterval(0, 1,
closedmin=True,
closedmax=True)], # margin added to xaxis
Expand Down
1 change: 1 addition & 0 deletions matplotlibrc.template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@
#axes.autolimit_mode : data ## How to scale axes limits to the data. By using:
## - "data" to use data limits, plus some margin
## - "round_numbers" move to the nearest "round" number
#axes.aspect : 'auto' ## axes aspect, options: 'auto', 'equal' or float
#axes.xmargin : .05 ## x margin. See `axes.Axes.margins`
#axes.ymargin : .05 ## y margin. See `axes.Axes.margins`
#polaraxes.grid : True ## display grid on polar axes
Expand Down

Back | FazBrowse Home | New Git URL