8000 Merge pull request #10101 from dstansby/sticky-radial-axis · matplotlib/matplotlib@046020b · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 046020b

Browse files
authored
Merge pull request #10101 from dstansby/sticky-radial-axis
ENH: Add origin as sticky point for radial axes
2 parents 89811a5 + 0ee539d commit 046020b

14 files changed

+8906
-9495
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Autoscaling a polar plot snaps to the origin
2+
--------------------------------------------
3+
4+
Setting the limits automatically in a polar plot now snaps the radial limit
5+
to zero if the automatic limit is nearby. This means plotting from zero doesn't
6+
automatically scale to include small negative values on the radial axis.
7+
8+
The limits can still be set manually in the usual way using `set_ylim`.

lib/matplotlib/projections/polar.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,10 @@ class RadialAxis(maxis.YAxis):
717717
__name__ = 'radialaxis'
718718
axis_name = 'radius'
719719

720+
def __init__(self, *args, **kwargs):
721+
super(RadialAxis, self).__init__(*args, **kwargs)
722+
self.sticky_edges.y.append(0)
723+
720724
def _get_tick(self, major):
721725
if major:
722726
tick_kw = self._major_tick_kw
@@ -849,6 +853,7 @@ def __init__(self, *args, **kwargs):
849853
kwargs.pop('rlabel_position', 22.5))
850854

851855
Axes.__init__(self, *args, **kwargs)
856+
self.use_sticky_edges = True
852857
self.set_aspect('equal', adjustable='box', anchor='C')
853858
self.cla()
854859
__init__.__doc__ = Axes.__init__.__doc__
Binary file not shown.
Loading

0 commit comments

Comments
 (0)
0