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

Commit24cd72d

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 parent3e9b656 commit24cd72d

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
@@ -664,12 +664,18 @@ def get_theta_offset(self):
664664
"""
665665
returnself._theta_offset.get_matrix()[0,2]
666666

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp