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 b4fc72b

Browse filesBrowse files
authored
Merge pull request #27578 from dstansby/polar-neg-lims
Fix polar labels with negative theta limit
2 parents 2467af4 + c57d8e1 commit b4fc72b
Copy full SHA for b4fc72b

File tree

Expand file treeCollapse file tree

2 files changed

+9
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-1
lines changed

‎lib/matplotlib/projections/polar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/projections/polar.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def set_axis(self, axis):
298298
def __call__(self):
299299
lim = self.axis.get_view_interval()
300300
if _is_full_circle_deg(lim[0], lim[1]):
301-
return np.arange(8) * 2 * np.pi / 8
301+
return np.deg2rad(min(lim)) + np.arange(8) * 2 * np.pi / 8
302302
else:
303303
return np.deg2rad(self.base())
304304

‎lib/matplotlib/tests/test_polar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_polar.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,3 +446,11 @@ def test_polar_log():
446446

447447
n = 100
448448
ax.plot(np.linspace(0, 2 * np.pi, n), np.logspace(0, 2, n))
449+
450+
451+
def test_polar_neg_theta_lims():
452+
fig = plt.figure()
453+
ax = fig.add_subplot(projection='polar')
454+
ax.set_thetalim(-np.pi, np.pi)
455+
labels = [l.get_text() for l in ax.xaxis.get_ticklabels()]
456+
assert labels == ['-180°', '-135°', '-90°', '-45°', '0°', '45°', '90°', '135°']

0 commit comments

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