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 1d4192c

Browse filesBrowse files
committed
Use \N{} unicode entities.
1 parent 5bfd4b7 commit 1d4192c
Copy full SHA for 1d4192c

File tree

Expand file treeCollapse file tree

9 files changed

+19
-33
lines changed
Filter options
Expand file treeCollapse file tree

9 files changed

+19
-33
lines changed

‎examples/api/custom_projection_example.py

Copy file name to clipboardExpand all lines: examples/api/custom_projection_example.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __call__(self, x, pos=None):
4747
if rcParams['text.usetex'] and not rcParams['text.latex.unicode']:
4848
return r"$%0.0f^\circ$" % degrees
4949
else:
50-
return "%0.0f\u00b0" % degrees
50+
return "%0.0f\N{DEGREE SIGN}" % degrees
5151

5252
RESOLUTION = 75
5353

@@ -286,7 +286,8 @@ def format_coord(self, lon, lat):
286286
ew = 'E'
287287
else:
288288
ew = 'W'
289-
return '%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(lon), ew)
289+
return ('%f\N{DEGREE SIGN}%s, %f\N{DEGREE SIGN}%s'
290+
% (abs(lat), ns, abs(lon), ew))
290291

291292
def set_longitude_grid(self, degrees):
292293
"""

‎examples/api/custom_scale_example.py

Copy file name to clipboardExpand all lines: examples/api/custom_scale_example.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ def set_default_locators_and_formatters(self, axis):
8686
"""
8787
class DegreeFormatter(Formatter):
8888
def __call__(self, x, pos=None):
89-
# \u00b0 : degree symbol
90-
return "%d\u00b0" % (np.degrees(x))
89+
return "%d\N{DEGREE SIGN}" % np.degrees(x)
9190

9291
axis.set_major_locator(FixedLocator(
9392
np.radians(np.arange(-90, 90, 10))))

‎examples/pylab_examples/tex_unicode_demo.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/tex_unicode_demo.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
plt.plot(t, s)
1919

2020
plt.xlabel(r'\textbf{time (s)}')
21-
plt.ylabel('\\textit{Velocity (\u00B0/sec)}', fontsize=16)
21+
plt.ylabel('\\textit{Velocity (\N{DEGREE SIGN}/sec)}', fontsize=16)
2222
plt.title(r'\TeX\ is Number $\displaystyle\sum_{n=1}^\infty'
2323
r'\frac{-e^{i\pi}}{2^n}$!', fontsize=16, color='r')
2424
plt.grid(True)

‎lib/matplotlib/backends/backend_pdf.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_pdf.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ def embedTTFType42(font, characters, descriptor):
10311031

10321032
# Make the 'W' (Widths) array, CidToGidMap and ToUnicode CMap
10331033
# at the same time
1034-
cid_to_gid_map = ['\u0000'] * 65536
1034+
cid_to_gid_map = ['\0'] * 65536
10351035
widths = []
10361036
max_ccode = 0
10371037
for c in characters:

‎lib/matplotlib/projections/geo.py

Copy file name to clipboardExpand all lines: lib/matplotlib/projections/geo.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __call__(self, x, pos=None):
3838
if rcParams['text.usetex'] and not rcParams['text.latex.unicode']:
3939
return r"$%0.0f^\circ$" % degrees
4040
else:
41-
return "%0.0f\u00b0" % degrees
41+
return "%0.0f\N{DEGREE SIGN}" % degrees
4242

4343
RESOLUTION = 75
4444

@@ -183,7 +183,8 @@ def format_coord(self, lon, lat):
183183
ew = 'E'
184184
else:
185185
ew = 'W'
186-
return '%f\u00b0%s, %f\u00b0%s' % (abs(lat), ns, abs(lon), ew)
186+
return ('%f\N{DEGREE SIGN}%s, %f\N{DEGREE SIGN}%s'
187+
% (abs(lat), ns, abs(lon), ew))
187188

188189
def set_longitude_grid(self, degrees):
189190
"""

‎lib/matplotlib/projections/polar.py

Copy file name to clipboardExpand all lines: lib/matplotlib/projections/polar.py
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ class ThetaFormatter(Formatter):
172172
unit of radians into degrees and adds a degree symbol.
173173
"""
174174
def __call__(self, x, pos=None):
175-
# \u00b0 : degree symbol
176175
if rcParams['text.usetex'] and not rcParams['text.latex.unicode']:
177176
return r"$%0.0f^\circ$" % ((x / np.pi) * 180.0)
178177
else:
@@ -181,7 +180,7 @@ def __call__(self, x, pos=None):
181180
# (assuming it has a degree sign), whereas $5\circ$
182181
# will only work correctly with one of the supported
183182
# math fonts (Computer Modern and STIX)
184-
return "%0.0f\u00b0" % ((x / np.pi) * 180.0)
183+
return "%0.0f\N{DEGREE SIGN}" % ((x / np.pi) * 180.0)
185184

186185

187186
class RadialLocator(Locator):
@@ -592,10 +591,8 @@ def format_coord(self, theta, r):
592591
characters.
593592
"""
594593
theta /= math.pi
595-
# \u03b8: lower-case theta
596-
# \u03c0: lower-case pi
597-
# \u00b0: degree symbol
598-
return '\u03b8=%0.3f\u03c0 (%0.3f\u00b0), r=%0.3f' % (theta, theta * 180.0, r)
594+
return ('\N{GREEK SMALL LETTER THETA}=%0.3f\N{GREEK SMALL LETTER PI} '
595+
'(%0.3f\N{DEGREE SIGN}), r=%0.3f') % (theta, theta * 180.0, r)
599596

600597
def get_data_ratio(self):
601598
'''

‎lib/matplotlib/tests/test_image.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_image.py
-9Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,6 @@ def test_imread_pil_uint16():
113113
assert (img.dtype == np.uint16)
114114
assert np.sum(img) == 134184960
115115

116-
# def test_image_unicode_io():
117-
# fig = plt.figure()
118-
# ax = fig.add_subplot(111)
119-
# ax.plot([1,2,3])
120-
# fname = u"\u0a3a\u0a3a.png"
121-
# fig.savefig(fname)
122-
# plt.imread(fname)
123-
# os.remove(fname)
124-
125116

126117
@cleanup
127118
def test_imsave():

‎lib/matplotlib/ticker.py

Copy file name to clipboardExpand all lines: lib/matplotlib/ticker.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ def fix_minus(self, s):
579579
if rcParams['text.usetex'] or not rcParams['axes.unicode_minus']:
580580
return s
581581
else:
582-
return s.replace('-', '\u2212')
582+
return s.replace('-', '\N{MINUS SIGN}')
583583

584584
def __call__(self, x, pos=None):
585585
"""
@@ -1202,7 +1202,7 @@ class EngFormatter(Formatter):
12021202
-15: "f",
12031203
-12: "p",
12041204
-9: "n",
1205-
-6: "\u03bc",
1205+
-6: "\N{GREEK SMALL LETTER MU}",
12061206
-3: "m",
12071207
0: "",
12081208
3: "k",
@@ -1236,7 +1236,7 @@ def format_eng(self, num):
12361236
'1.0 M'
12371237
12381238
>>> format_eng("-1e-6") # for self.places = 2
1239-
u'-1.00 \u03bc'
1239+
u'-1.00 \N{GREEK SMALL LETTER MU}'
12401240
12411241
`num` may be a numeric value or a string that can be converted
12421242
to a numeric value with the `decimal.Decimal` constructor.

‎tools/test_triage.py

Copy file name to clipboardExpand all lines: tools/test_triage.py
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,11 @@ def display(self):
301301
Get the display string for this entry. This is the text that
302302
appears in the list widget.
303303
"""
304-
status_map = {
305-
'unknown': '\u2610',
306-
'accept': '\u2611',
307-
'reject': '\u2612'
308-
}
304+
status_map = {'unknown': '\N{BALLOT BOX}',
305+
'accept': '\N{BALLOT BOX WITH CHECK}',
306+
'reject': '\N{BALLOT BOX WITH X}'}
309307
box = status_map[self.status]
310-
return '{} {} [{}]'.format(
311-
box, self.name, self.extension)
308+
return '{} {} [{}]'.format(box, self.name, self.extension)
312309

313310
def accept(self):
314311
"""

0 commit comments

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