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 ea6c760

Browse filesBrowse files
committed
Improve Unicode minus example
1 parent 3ba7b19 commit ea6c760
Copy full SHA for ea6c760

File tree

Expand file treeCollapse file tree

1 file changed

+12
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-4
lines changed

‎examples/text_labels_and_annotations/unicode_minus.py

Copy file name to clipboardExpand all lines: examples/text_labels_and_annotations/unicode_minus.py
+12-4Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.