@@ -28,15 +28,6 @@ def format_axes(ax):
2828 ax .invert_yaxis ()
2929
3030
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-
4031def split_list (a_list ):
4132 i_half = len (a_list ) // 2
4233 return (a_list [:i_half ], a_list [i_half :])
@@ -46,7 +37,6 @@ def split_list(a_list):
4637# Filled and unfilled-marker types
4738# ================================
4839#
49- #
5040# Plot all un-filled markers
5141
5242fig , axes = plt .subplots (ncols = 2 )
@@ -58,9 +48,9 @@ def split_list(a_list):
5848
5949for ax , markers in zip (axes , split_list (unfilled_markers )):
6050 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 )
6252 ax .plot (y * points , marker = marker , ** marker_style )
63- format_axes (ax )
53+ format_axes (ax )
6454
6555plt .show ()
6656
@@ -71,9 +61,9 @@ def split_list(a_list):
7161fig , axes = plt .subplots (ncols = 2 )
7262for ax , markers in zip (axes , split_list (Line2D .filled_markers )):
7363 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 )
7565 ax .plot (y * points , marker = marker , ** marker_style )
76- format_axes (ax )
66+ format_axes (ax )
7767fig .suptitle ('filled markers' , fontsize = 14 )
7868
7969plt .show ()
@@ -83,7 +73,6 @@ def split_list(a_list):
8373# Custom Markers with MathText
8474# ============================
8575#
86- #
8776# Use :doc:`MathText </tutorials/text/mathtext>`, to use custom marker symbols,
8877# like e.g. ``"$\u266B$"``. For an overview over the STIX font symbols refer
8978# to the `STIX font table <http://www.stixfonts.org/allGlyphs.html>`_.
@@ -99,8 +88,10 @@ def split_list(a_list):
9988
10089
10190for 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 )
10393 ax .plot (y * points , marker = marker , ** marker_style )
10494format_axes (ax )
95+ fig .suptitle ('mathtext markers' , fontsize = 14 )
10596
10697plt .show ()
0 commit comments