Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit1ef609b

Browse files
committed
ENH: Allow offsetting PolarAxes' zero location.
Let the user specify an arbitrary zero location with reference to theusual cardinal points. This can be a bit more intuitive than requiringthe offset in radians.
1 parent7731471 commit1ef609b

File tree

5 files changed

+604
-598
lines changed

5 files changed

+604
-598
lines changed

‎lib/matplotlib/projections/polar.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,12 +663,18 @@ def get_theta_offset(self):
663663
"""
664664
returnself._theta_offset.get_matrix()[0,2]
665665

666-
defset_theta_zero_location(self,loc):
666+
defset_theta_zero_location(self,loc,offset=0.0):
667667
"""
668668
Sets the location of theta's zero. (Calls set_theta_offset
669669
with the correct value in radians under the hood.)
670670
671-
May be one of "N", "NW", "W", "SW", "S", "SE", "E", or "NE".
671+
loc : str
672+
May be one of "N", "NW", "W", "SW", "S", "SE", "E", or "NE".
673+
674+
offset : float, optional
675+
An offset in degrees to apply from the specified `loc`. **Note:**
676+
this offset is *always* applied counter-clockwise regardless of
677+
the direction setting.
672678
"""
673679
mapping= {
674680
'N':np.pi*0.5,
@@ -679,7 +685,7 @@ def set_theta_zero_location(self, loc):
679685
'SE':np.pi*1.75,
680686
'E':0,
681687
'NE':np.pi*0.25 }
682-
returnself.set_theta_offset(mapping[loc])
688+
returnself.set_theta_offset(mapping[loc]+np.deg2rad(offset))
683689

684690
defset_theta_direction(self,direction):
685691
"""
Binary file not shown.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp