File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed
Filter options
examples/text_labels_and_annotations Expand file tree Collapse file tree 1 file changed +7
-14
lines changed
Original file line number Diff line number Diff line change 3
3
Unicode minus
4
4
=============
5
5
6
- You can use the proper typesetting `Unicode minus`__ or the ASCII hyphen for
7
- minus, which some people prefer. :rc:`axes.unicode_minus` controls the default
8
- behavior .
6
+ By default, tick labels at negative values are rendered using a `Unicode
7
+ minus`__ (U+2212) rather than an ASCII hyphen (U+002D). This can be controlled
8
+ by setting :rc:`axes.unicode_minus` (which defaults to True) .
9
9
10
10
__ https://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes
11
11
12
- The default is to use the Unicode minus .
12
+ This example showcases the difference between the two glyphs .
13
13
"""
14
14
15
- import numpy as np
16
- import matplotlib
17
15
import matplotlib .pyplot as plt
18
16
19
- # Fixing random state for reproducibility
20
- np .random .seed (19680801 )
21
-
22
-
23
- matplotlib .rcParams ['axes.unicode_minus' ] = False
24
- fig , ax = plt .subplots ()
25
- ax .plot (10 * np .random .randn (100 ), 10 * np .random .randn (100 ), 'o' )
26
- ax .set_title ('Using hyphen instead of Unicode minus' )
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" )
27
20
plt .show ()
You can’t perform that action at this time.
0 commit comments