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

Skip to content

Commit 31af3ff

Browse files
committed
Fix aspect ratio calculation for polar plots.
svn path=/trunk/matplotlib/; revision=8302
1 parent 3cc8b53 commit 31af3ff

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

lib/matplotlib/axes.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,20 +1084,23 @@ def apply_aspect(self, position=None):
10841084

10851085
aspect = self.get_aspect()
10861086

1087-
xscale, yscale = self.get_xscale(), self.get_yscale()
1088-
if xscale == "linear" and yscale == "linear":
1087+
if self.name != 'polar':
1088+
xscale, yscale = self.get_xscale(), self.get_yscale()
1089+
if xscale == "linear" and yscale == "linear":
1090+
aspect_scale_mode = "linear"
1091+
elif xscale == "log" and yscale == "log":
1092+
aspect_scale_mode = "log"
1093+
elif (xscale == "linear" and yscale == "log") or \
1094+
(xscale == "log" and yscale == "linear"):
1095+
if aspect is not "auto":
1096+
warnings.warn(
1097+
'aspect is not supported for Axes with xscale=%s, yscale=%s' \
1098+
% (xscale, yscale))
1099+
aspect = "auto"
1100+
else: # some custom projections have their own scales.
1101+
pass
1102+
else:
10891103
aspect_scale_mode = "linear"
1090-
elif xscale == "log" and yscale == "log":
1091-
aspect_scale_mode = "log"
1092-
elif (xscale == "linear" and yscale == "log") or \
1093-
(xscale == "log" and yscale == "linear"):
1094-
if aspect is not "auto":
1095-
warnings.warn(
1096-
'aspect is not supported for Axes with xscale=%s, yscale=%s' \
1097-
% (xscale, yscale))
1098-
aspect = "auto"
1099-
else: # some custom projections have their own scales.
1100-
pass
11011104

11021105
if aspect == 'auto':
11031106
self.set_position( position , which='active')

0 commit comments

Comments
 (0)