8000 Make unicode_minus example more focused. by anntzer · Pull Request #13945 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Make unicode_minus example more focused. #13945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions examples/text_labels_and_annotations/unicode_minus.py
8000
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,18 @@
Unicode minus
=============

You can use the proper typesetting `Unicode minus`__ or the ASCII hyphen for
minus, which some people prefer. :rc:`axes.unicode_minus` controls the default
behavior.
By default, tick labels at negative values are rendered using a `Unicode
minus`__ (U+2212) rather than an ASCII hyphen (U+002D). This can be controlled
by setting :rc:`axes.unicode_minus` (which defaults to True).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence seems incomplete:

Suggested change
by setting :rc:`axes.unicode_minus` (which defaults to True).
by setting :rc:`axes.unicode_minus` (which defaults to True) to False.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"It can be controlled by setting the rcParam (meaning, to either value)"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is fine the way it is.


__ https://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes

The default is to use the Unicode minus.
This example showcases the difference between the two glyphs.
"""

import numpy as np
import matplotlib
import matplotlib.pyplot as plt

# Fixing random state for reproducibility
np.random.seed(19680801)


matplotlib.rcParams['axes.unicode_minus'] = False
fig, ax = plt.subplots()
ax.plot(10*np.random.randn(100), 10*np.random.randn(100), 'o')
ax.set_title('Using hyphen instead of Unicode minus')
fig = plt.figure()
fig.text(.5, .5, "Unicode minus: \N{MINUS SIGN}1", horizontalalignment="right")
fig.text(.5, .4, "ASCII hyphen: -1", horizontalalignment="right")
plt.show()
0