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

Commitd163a75

Browse files
committed
Use \N{} unicode entities.
1 parent912bb80 commitd163a75

File tree

9 files changed

+19
-33
lines changed

9 files changed

+19
-33
lines changed

‎examples/api/custom_projection_example.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __call__(self, x, pos=None):
4848
ifrcParams['text.usetex']andnotrcParams['text.latex.unicode']:
4949
returnr"$%0.0f^\circ$"%degrees
5050
else:
51-
return"%0.0f\u00b0"%degrees
51+
return"%0.0f\N{DEGREE SIGN}"%degrees
5252

5353
RESOLUTION=75
5454

@@ -288,7 +288,8 @@ def format_coord(self, lon, lat):
288288
ew='E'
289289
else:
290290
ew='W'
291-
return'%f\u00b0%s, %f\u00b0%s'% (abs(lat),ns,abs(lon),ew)
291+
return ('%f\N{DEGREE SIGN}%s, %f\N{DEGREE SIGN}%s'
292+
% (abs(lat),ns,abs(lon),ew))
292293

293294
defset_longitude_grid(self,degrees):
294295
"""

‎examples/api/custom_scale_example.py

Lines 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
classDegreeFormatter(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

Lines 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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ def embedTTFType42(font, characters, descriptor):
10081008

10091009
# Make the 'W' (Widths) array, CidToGidMap and ToUnicode CMap
10101010
# at the same time
1011-
cid_to_gid_map= ['\u0000']*65536
1011+
cid_to_gid_map= ['\0']*65536
10121012
widths= []
10131013
max_ccode=0
10141014
forcincharacters:

‎lib/matplotlib/projections/geo.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __call__(self, x, pos=None):
3838
ifrcParams['text.usetex']andnotrcParams['text.latex.unicode']:
3939
returnr"$%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

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

189190
defset_longitude_grid(self,degrees):
190191
"""

‎lib/matplotlib/projections/polar.py

Lines 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
ifrcParams['text.usetex']andnotrcParams['text.latex.unicode']:
177176
returnr"$%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
classRadialLocator(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
defget_data_ratio(self):
601598
'''

‎lib/matplotlib/tests/test_image.py

Lines 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
assertnp.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
deftest_imsave():

‎lib/matplotlib/ticker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ def fix_minus(self, s):
579579
ifrcParams['text.usetex']ornotrcParams['axes.unicode_minus']:
580580
returns
581581
else:
582-
returns.replace('-','\u2212')
582+
returns.replace('-','\N{MINUS SIGN}')
583583

584584
def__call__(self,x,pos=None):
585585
"""
@@ -1133,7 +1133,7 @@ class EngFormatter(Formatter):
11331133
-15:"f",
11341134
-12:"p",
11351135
-9:"n",
1136-
-6:"\u03bc",
1136+
-6:"\N{GREEK SMALL LETTER MU}",
11371137
-3:"m",
11381138
0:"",
11391139
3:"k",
@@ -1167,7 +1167,7 @@ def format_eng(self, num):
11671167
'1.0 M'
11681168
11691169
>>> format_eng("-1e-6") # for self.places = 2
1170-
u'-1.00\u03bc'
1170+
u'-1.00\N{GREEK SMALL LETTER MU}'
11711171
11721172
`num` may be a numeric value or a string that can be converted
11731173
to a numeric value with the `decimal.Decimal` constructor.

‎tools/test_triage.py

Lines 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
defaccept(self):
314311
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp