Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2b8b189

Browse files
authored
Merge pull request #14023 from timhoffm/example-unicode-minus
Improve Unicode minus example
2 parents 6e49e89 + ea6c760 commit 2b8b189

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

examples/text_labels_and_annotations/unicode_minus.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,20 @@
99
1010
__ https://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes
1111
12-
This example showcases the difference between the two glyphs.
12+
The replacement is performed at draw time of the tick labels (usually during a
13+
`.pyplot.show()` or `.pyplot.savefig()` call). Therefore, all tick labels of
14+
the figure follow the same setting and we cannot demonstrate both glyphs on
15+
real tick labels of the same figure simultaneously.
16+
17+
Instead, this example simply showcases the difference between the two glyphs
18+
in a magnified font.
1319
"""
1420

1521
import matplotlib.pyplot as plt
1622

17-
fig = plt.figure()
18-
fig.text(.5, .5, "Unicode minus: \N{MINUS SIGN}1", horizontalalignment="right")
19-
fig.text(.5, .4, "ASCII hyphen: -1", horizontalalignment="right")
23+
fig = plt.figure(figsize=(4, 2))
24+
fig.text(.15, .6, "Unicode minus:", fontsize=20)
25+
fig.text(.85, .6, "\N{MINUS SIGN}1", ha='right', fontsize=20)
26+
fig.text(.15, .3, "ASCII hyphen:", fontsize=20)
27+
fig.text(.85, .3, "-1", ha='right', fontsize=20)
2028
plt.show()

0 commit comments

Comments
 (0)