Skip to content

Commit 88cb4c9

Browse files
committed
Properly capitalize "Unicode".
See e.g. https://en.wikipedia.org/wiki/Unicode, https://docs.python.org/3/howto/unicode.html. Also associated minor doc cleanups.
1 parent 30db833 commit 88cb4c9

File tree

18 files changed

+32
-32
lines changed

18 files changed

+32
-32
lines changed

examples/pyplots/text_commands.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15)
2525

26-
ax.text(3, 2, 'unicode: Institut f\374r Festk\366rperphysik')
26+
ax.text(3, 2, 'Unicode: Institut f\374r Festk\366rperphysik')
2727

2828
ax.text(0.95, 0.01, 'colored text in axes coords',
2929
verticalalignment='bottom', horizontalalignment='right',

examples/text_labels_and_annotations/accented_text.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
r"""
22
=================================
3-
Using accented text in matplotlib
3+
Using accented text in Matplotlib
44
=================================
55
6-
Matplotlib supports accented characters via TeX mathtext or unicode.
6+
Matplotlib supports accented characters via TeX mathtext or Unicode.
77
88
Using mathtext, the following accents are provided: \\hat, \\breve, \\grave,
99
\\bar, \\acute, \\tilde, \\vec, \\dot, \\ddot. All of them have the same

lib/matplotlib/_mathtext.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ def get_unicode_index(symbol, math=True):
4141
Parameters
4242
----------
4343
symbol : str
44-
A single unicode character, a TeX command (e.g. r'\pi') or a Type1
44+
A single (Unicode) character, a TeX command (e.g. r'\pi') or a Type1
4545
symbol name (e.g. 'phi').
4646
math : bool, default: True
47-
If False, always treat as a single unicode character.
47+
If False, always treat as a single Unicode character.
4848
"""
49-
# for a non-math symbol, simply return its unicode index
49+
# for a non-math symbol, simply return its Unicode index
5050
if not math:
5151
return ord(symbol)
5252
# From UTF #25: U+2212 minus sign is the preferred
@@ -56,7 +56,7 @@ def get_unicode_index(symbol, math=True):
5656
# length, usually longer than a hyphen.
5757
if symbol == '-':
5858
return 0x2212
59-
try: # This will succeed if symbol is a single unicode char
59+
try: # This will succeed if symbol is a single Unicode char
6060
return ord(symbol)
6161
except TypeError:
6262
pass
@@ -482,7 +482,7 @@ def _get_glyph(self, fontname, font_class, sym, fontsize, math=True):
482482
except ValueError:
483483
uniindex = ord('?')
484484
found_symbol = False
485-
_log.warning("No TeX to unicode mapping for {!a}.".format(sym))
485+
_log.warning("No TeX to Unicode mapping for {!a}.".format(sym))
486486

487487
fontname, uniindex = self._map_virtual_font(
488488
fontname, font_class, uniindex)

lib/matplotlib/backends/backend_pdf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787

8888
# TODOs:
8989
#
90-
# * encoding of fonts, including mathtext fonts and unicode support
90+
# * encoding of fonts, including mathtext fonts and Unicode support
9191
# * TTF support has lots of small TODOs, e.g., how do you know if a font
9292
# is serif/sans-serif, or symbolic/non-symbolic?
9393
# * draw_quad_mesh

lib/matplotlib/backends/backend_qt.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
backend_version = __version__
2424

25-
# SPECIAL_KEYS are Qt::Key that do *not* return their unicode name
25+
# SPECIAL_KEYS are Qt::Key that do *not* return their Unicode name
2626
# instead they have manually specified names.
2727
SPECIAL_KEYS = {
2828
_to_int(getattr(_enum("QtCore.Qt.Key"), k)): v for k, v in [
@@ -374,12 +374,12 @@ def _get_key(self, event):
374374
if event_key != key and event_mods & mod]
375375
try:
376376
# for certain keys (enter, left, backspace, etc) use a word for the
377-
# key, rather than unicode
377+
# key, rather than Unicode
378378
key = SPECIAL_KEYS[event_key]
379379
except KeyError:
380-
# unicode defines code points up to 0x10ffff (sys.maxunicode)
380+
# Unicode defines code points up to 0x10ffff (sys.maxunicode)
381381
# QT will use Key_Codes larger than that for keyboard keys that are
382-
# are not unicode characters (like multimedia keys)
382+
# are not Unicode characters (like multimedia keys)
383383
# skip these
384384
# if you really want them, you should add them to SPECIAL_KEYS
385385
if event_key > sys.maxunicode:

lib/matplotlib/backends/qt_editor/_formlayout.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ def fedit(data, title="", comment="", icon=None, parent=None, apply=None):
517517
box) for each member of a datagroup inside a datagroup
518518
519519
Supported types for field_value:
520-
- int, float, str, unicode, bool
520+
- int, float, str, bool
521521
- colors: in Qt-compatible text form, i.e. in hex format or name
522522
(red, ...) (automatically detected from a string)
523523
- list/tuple:

lib/matplotlib/mpl-data/stylelib/classic.mplstyle

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ axes.formatter.offset_threshold : 2 # When useoffset is True, the offset
207207
# at least this number of significant
208208
# digits from tick labels.
209209

210-
axes.unicode_minus : True # use unicode for the minus symbol
210+
axes.unicode_minus : True # use Unicode for the minus symbol
211211
# rather than hyphen. See
212212
# https://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes
213213
axes.prop_cycle : cycler('color', 'bgrcmyk')

lib/matplotlib/projections/polar.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def __call__(self, x, pos=None):
193193
vmin, vmax = self.axis.get_view_interval()
194194
d = np.rad2deg(abs(vmax - vmin))
195195
digits = max(-int(np.log10(d) - 1.5), 0)
196-
# Use unicode rather than mathtext with \circ, so that it will work
196+
# Use Unicode rather than mathtext with \circ, so that it will work
197197
# correctly with any arbitrary font (assuming it has a degree sign),
198198
# whereas $5\circ$ will only work correctly with one of the supported
199199
# math fonts (Computer Modern and STIX).

lib/matplotlib/tests/test_backend_qt.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def _test_enums_impl():
512512

513513
_enum("QtGui.QImage.Format").Format_ARGB32_Premultiplied
514514
_enum("QtGui.QImage.Format").Format_ARGB32_Premultiplied
515-
# SPECIAL_KEYS are Qt::Key that do *not* return their unicode name instead
515+
# SPECIAL_KEYS are Qt::Key that do *not* return their Unicode name instead
516516
# they have manually specified names.
517517
SPECIAL_KEYS = {
518518
_to_int(getattr(_enum("QtCore.Qt.Key"), k)): v

lib/matplotlib/tests/test_ticker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,7 @@ def test_params(self, unicode_minus, input, expected):
11831183
assert _formatter(input) == _exp_output
11841184

11851185
# Test several non default separators: no separator, a narrow
1186-
# no-break space (unicode character) and an extravagant string.
1186+
# no-break space (Unicode character) and an extravagant string.
11871187
for _sep in ("", "\N{NARROW NO-BREAK SPACE}", "@_@"):
11881188
# Case 2: unit=UNIT and sep=_sep.
11891189
# Replace the default space separator from the reference case

lib/matplotlib/texmanager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class TexManager:
7979
'avant garde': ('pag', r'\usepackage{avant}'),
8080
'courier': ('pcr', r'\usepackage{courier}'),
8181
# Loading the type1ec package ensures that cm-super is installed, which
82-
# is necessary for unicode computer modern. (It also allows the use of
82+
# is necessary for Unicode computer modern. (It also allows the use of
8383
# computer modern at arbitrary sizes, but that's just a side effect.)
8484
'monospace': ('cmtt', r'\usepackage{type1ec}'),
8585
'computer modern roman': ('cmr', r'\usepackage{type1ec}'),

lib/matplotlib/textpath.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def _get_ps_font_and_encoding(texname):
292292
# If psfonts.map specifies an encoding, use it: it gives us a
293293
# mapping of glyph indices to Adobe glyph names; use it to convert
294294
# dvi indices to glyph names and use the FreeType-synthesized
295-
# unicode charmap to convert glyph names to glyph indices (with
295+
# Unicode charmap to convert glyph names to glyph indices (with
296296
# FT_Get_Name_Index/get_name_index), and load the glyph using
297297
# FT_Load_Glyph/load_glyph. (That charmap has a coverage at least
298298
# as good as, and possibly better than, the native charmaps.)

lib/matplotlib/ticker.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def set_locs(self, locs):
254254
def fix_minus(s):
255255
"""
256256
Some classes may want to replace a hyphen for minus with the proper
257-
unicode symbol (U+2212) for typographical correctness. This is a
257+
Unicode symbol (U+2212) for typographical correctness. This is a
258258
helper method to perform such a replacement when it is enabled via
259259
:rc:`axes.unicode_minus`.
260260
"""
@@ -344,9 +344,9 @@ class FormatStrFormatter(Formatter):
344344
The format string should have a single variable format (%) in it.
345345
It will be applied to the value (not the position) of the tick.
346346
347-
Negative numeric values will use a dash not a unicode minus,
348-
use mathtext to get a unicode minus by wrappping the format specifier
349-
with $ (e.g. "$%g$").
347+
Negative numeric values will use a dash, not a Unicode minus; use mathtext
348+
to get a Unicode minus by wrappping the format specifier with $ (e.g.
349+
"$%g$").
350350
"""
351351
def __init__(self, fmt):
352352
self.fmt = fmt
@@ -542,7 +542,7 @@ def set_useLocale(self, val):
542542

543543
def _format_maybe_minus_and_locale(self, fmt, arg):
544544
"""
545-
Format *arg* with *fmt*, applying unicode minus and locale if desired.
545+
Format *arg* with *fmt*, applying Unicode minus and locale if desired.
546546
"""
547547
return self.fix_minus(locale.format_string(fmt, (arg,), True)
548548
if self._useLocale else fmt % arg)

tools/create_DejaVuDisplay.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Subsetting DejaVu fonts to create a display-math-only font
44

5-
# The DejaVu fonts include math display variants outside of the unicode range,
5+
# The DejaVu fonts include math display variants outside of the Unicode range,
66
# and it is currently hard to access them from matploltib. The subset.py script
77
# in `tools` has been modified to move the math display variants found in DejaVu
8-
# fonts into a new TTF font with these variants in the unicode range.
8+
# fonts into a new TTF font with these variants in the Unicode range.
99

1010
# This bash script calls the subset.py scripts with the appropriate options to
1111
# generate the new font files `DejaVuSansDisplay.ttf` and

tools/gh_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def encode_multipart_formdata(fields, boundary=None):
216216
bytes. If the value is a tuple of two elements, then the first element
217217
is treated as the filename of the form-data section.
218218
219-
Field names and filenames must be unicode.
219+
Field names and filenames must be str.
220220
221221
:param boundary:
222222
If not specified, then a random boundary will be generated using

tools/subset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def subset_font_raw(font_in, font_out, unicodes, opts):
128128
print("Clear()", file=pe)
129129

130130
if '--move-display' in opts:
131-
print("Moving display glyphs into unicode ranges...")
131+
print("Moving display glyphs into Unicode ranges...")
132132
font.familyname += " Display"
133133
font.fullname += " Display"
134134
font.fontname += "Display"

tutorials/text/README.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ Text
66
matplotlib has extensive text support, including support for
77
mathematical expressions, truetype support for raster and
88
vector outputs, newline separated text with arbitrary
9-
rotations, and unicode support. These tutorials cover
9+
rotations, and Unicode support. These tutorials cover
1010
the basics of working with text in Matplotlib.

tutorials/text/text_intro.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Matplotlib has extensive text support, including support for
99
mathematical expressions, truetype support for raster and
1010
vector outputs, newline separated text with arbitrary
11-
rotations, and unicode support.
11+
rotations, and Unicode support.
1212
1313
Because it embeds fonts directly in output documents, e.g., for postscript
1414
or PDF, what you see on the screen is what you get in the hardcopy.
@@ -87,7 +87,7 @@
8787

8888
ax.text(2, 6, r'an equation: $E=mc^2$', fontsize=15)
8989

90-
ax.text(3, 2, 'unicode: Institut für Festkörperphysik')
90+
ax.text(3, 2, 'Unicode: Institut für Festkörperphysik')
9191

9292
ax.text(0.95, 0.01, 'colored text in axes coords',
9393
verticalalignment='bottom', horizontalalignment='right',

0 commit comments

Comments
 (0)