-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Expand file tree
/
Copy pathunicode_minus.py
More file actions
25 lines (20 loc) · 671 Bytes
/
unicode_minus.py
File metadata and controls
25 lines (20 loc) · 671 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
=============
Unicode minus
=============
You can use the proper typesetting Unicode minus (see
https://en.wikipedia.org/wiki/Plus_sign#Plus_sign) or the ASCII hyphen
for minus, which some people prefer. The matplotlibrc param
axes.unicode_minus controls the default behavior.
The default is to use the Unicode minus.
"""
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
# Fixing random state for reproducibility
np.random.seed(19680801)
matplotlib.rcParams['axes.unicode_minus'] = False
fig, ax = plt.subplots()
ax.plot(10*np.random.randn(100), 10*np.random.randn(100), 'o')
ax.set_title('Using hyphen instead of Unicode minus')
plt.show()