Skip to content

Commit e1d2781

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 6a5fd7b commit e1d2781

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

lib/matplotlib/projections/polar.py

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

776-
# Ensure equal aspect ratio.
777-
w, h = self._points[1] - self._points[0]
778-
deltah = max(w - h, 0) / 2
779-
deltaw = max(h - w, 0) / 2
780-
self._points += np.array([[-deltaw, -deltah], [deltaw, deltah]])
781-
782776
self._invalid = 0
783777

784778
return self._points
@@ -974,6 +968,7 @@ def get_yaxis_text2_transform(self, pad):
974968
def draw(self, renderer):
975969
self._unstale_viewLim()
976970
self.axesLim.get_points() # Unstale bbox and Axes patch.
971+
self.set_aspect(self.axesLim.height / self.axesLim.width)
977972
if isinstance(self.patch, mpatches.Wedge):
978973
# Backwards-compatibility: Any subclassed Axes might override the
979974
# patch to not be the Wedge that PolarAxes uses.
Loading

0 commit comments

Comments
 (0)