8000 Merge pull request #11536 from matplotlib/auto-backport-of-pr-11532-o… · matplotlib/matplotlib@7f4a8d4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7f4a8d4

Browse files
authored
Merge pull request #11536 from matplotlib/auto-backport-of-pr-11532-on-v2.2.2-doc
Backport PR #11532 on branch v2.2.2-doc
2 parents 9df44ba + d0b5f94 commit 7f4a8d4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

examples/units/basic_units.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,21 @@ def __call__(self, operation, units):
298298

299299
# radians formatting
300300
def rad_fn(x, pos=None):
301-
n = int((x / np.pi) * 2.0 + 0.25)
301+
if x >= 0:
302+
n = int((x / np.pi) * 2.0 + 0.25)
303+
else:
304+
n = int((x / np.pi) * 2.0 - 0.25)
305+
302306
if n == 0:
303307
return '0'
304308
elif n == 1:
305309
return r'$\pi/2$'
306310
elif n == 2:
307311
return r'$\pi$'
312+
elif n == -1:
313+
return r'$-\pi/2$'
314+
elif n == -2:
315+
return r'$-\pi$'
308316
elif n % 2 == 0:
309317
return r'$%s\pi$' % (n//2,)
310318
else:

0 commit comments

Comments
 (0)
0