@@ -28,15 +28,6 @@ def format_axes(ax):
28
28
ax .invert_yaxis ()
29
29
30
30
31
- def nice_repr (text ):
32
- return repr (text ).lstrip ('u' )
33
-
34
-
35
- def math_repr (text ):
36
- tx = repr (text ).lstrip ('u' ).strip ("'" ).strip ("$" )
37
- return r"'\${}\$'" .format (tx )
38
-
39
-
40
31
def split_list (a_list ):
41
32
i_half = len (a_list ) // 2
42
33
return (a_list [:i_half ], a_list [i_half :])
@@ -46,7 +37,6 @@ def split_list(a_list):
46
37
# Filled and unfilled-marker types
47
38
# ================================
48
39
#
49
- #
50
40
# Plot all un-filled markers
51
41
52
42
fig , axes = plt .subplots (ncols = 2 )
@@ -58,9 +48,9 @@ def split_list(a_list):
58
48
59
49
for ax , markers in zip (axes , split_list (unfilled_markers )):
60
50
for y , marker in enumerate (markers ):
61
- ax .text (- 0.5 , y , nice_repr (marker ), ** text_style )
51
+ ax .text (- 0.5 , y , repr (marker ), ** text_style )
62
52
ax .plot (y * points , marker = marker , ** marker_style )
63
- format_axes (ax )
53
+ format_axes (ax )
64
54
65
55
plt .show ()
66
56
@@ -71,9 +61,9 @@ def split_list(a_list):
71
61
fig , axes = plt .subplots (ncols = 2 )
72
62
for ax , markers in zip (axes , split_list (Line2D .filled_markers )):
73
63
for y , marker in enumerate (markers ):
74
- ax .text (- 0.5 , y , nice_repr (marker ), ** text_style )
64
+ ax .text (- 0.5 , y , repr (marker ), ** text_style )
75
65
ax .plot (y * points , marker = marker , ** marker_style )
76
- format_axes (ax )
66
+ format_axes (ax )
77
67
fig .suptitle ('filled markers' , fontsize = 14 )
78
68
79
69
plt .show ()
@@ -83,7 +73,6 @@ def split_list(a_list):
83
73
# Custom Markers with MathText
84
74
# ============================
85
75
#
86
- #
87
76
# Use :doc:`MathText </tutorials/text/mathtext>`, to use custom marker symbols,
88
77
# like e.g. ``"$\u266B$"``. For an overview over the STIX font symbols refer
89
78
# to the `STIX font table <http://www.stixfonts.org/allGlyphs.html>`_.
@@ -99,8 +88,10 @@ def split_list(a_list):
99
88
100
89
101
90
for y , marker in enumerate (markers ):
102
- ax .text (- 0.5 , y , math_repr (marker ), ** text_style )
91
+ # Escape dollars so that the text is written "as is", not as mathtext.
92
+ ax .text (- 0.5 , y , repr (marker ).replace ("$" , r"\$" ), ** text_style )
103
93
ax .plot (y * points , marker = marker , ** marker_style )
104
94
format_axes (ax )
95
+ fig .suptitle ('mathtext markers' , fontsize = 14 )
105
96
106
97
plt .show ()
0 commit comments