Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aac76e0

Browse filesBrowse files
committed
ENH: Allow offsetting PolarAxes' zero location.
Let the user specify an arbitrary zero location with reference to the usual cardinal points. This can be a bit more intuitive than requiring the offset in radians.
1 parent f28e3a8 commit aac76e0
Copy full SHA for aac76e0

File tree

Expand file treeCollapse file tree

5 files changed

+604
-598
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+604
-598
lines changed

‎lib/matplotlib/projections/polar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/projections/polar.py
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,12 +665,18 @@ def get_theta_offset(self):
665665
"""
666666
return self._theta_offset.get_matrix()[0, 2]
667667

668-
def set_theta_zero_location(self, loc):
668+
def set_theta_zero_location(self, loc, offset=0.0):
669669
"""
670670
Sets the location of theta's zero. (Calls set_theta_offset
671671
with the correct value in radians under the hood.)
672672
673-
May be one of "N", "NW", "W", "SW", "S", "SE", "E", or "NE".
673+
loc : str
674+
May be one of "N", "NW", "W", "SW", "S", "SE", "E", or "NE".
675+
676+
offset : float, optional
677+
An offset in degrees to apply from the specified `loc`. **Note:**
678+
this offset is *always* applied counter-clockwise regardless of
679+
the direction setting.
674680
"""
675681
mapping = {
676682
'N': np.pi * 0.5,
@@ -681,7 +687,7 @@ def set_theta_zero_location(self, loc):
681687
'SE': np.pi * 1.75,
682688
'E': 0,
683689
'NE': np.pi * 0.25 }
684-
return self.set_theta_offset(mapping[loc])
690+
return self.set_theta_offset(mapping[loc] + np.deg2rad(offset))
685691

686692
def set_theta_direction(self, direction):
687693
"""
Binary file not shown.
Loading

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.