Skip to content

Commit 1a6bbc7

Browse files
committed
Use the correct aspect ratio for non-full polar Axes
No longer expand the wedge bbox to make a square, but instead export at whatever size it has. Then also apply its aspect ratio to the Axes itself, so that the Axes' 'active' position is correct. This allows wedge-shaped PolarAxes to expand to fill their allocated space.
1 parent c278389 commit 1a6bbc7

File tree

4 files changed

+2921
-2759
lines changed

4 files changed

+2921
-2759
lines changed

lib/matplotlib/projections/polar.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -813,12 +813,6 @@ def get_points(self):
813813
wedge.set_width(width)
814814
self.update_from_path(wedge.get_path(), ignore=True)
815815

816-
# Ensure equal aspect ratio.
817-
w, h = self._points[1] - self._points[0]
818-
deltah = max(w - h, 0) / 2
819-
deltaw = max(h - w, 0) / 2
820-
self._points += np.array([[-deltaw, -deltah], [deltaw, deltah]])
821-
822816
self._invalid = 0
823817

824818
return self._points
@@ -1015,6 +1009,7 @@ def get_yaxis_text2_transform(self, pad):
10151009
def draw(self, renderer):
10161010
self._unstale_viewLim()
10171011
self.axesLim.get_points() # Unstale bbox and Axes patch.
1012+
self.set_aspect(self.axesLim.height / self.axesLim.width)
10181013
if isinstance(self.patch, mpatches.Wedge):
10191014
# Backwards-compatibility: Any subclassed Axes might override the
10201015
# patch to not be the Wedge that PolarAxes uses.
Binary file not shown.
10.8 KB
Loading

0 commit comments

Comments
 (0)