1
1
import matplotlib as mpl
2
2
import numpy as np
3
- from matplotlib .backends .backend_pgf import (
4
- common_texification as mpl_common_texification ,
5
- )
3
+ from matplotlib .backends .backend_pgf import _tex_escape as mpl_tex_escape
6
4
7
5
from . import _color
8
6
9
7
10
- def _common_texification (string ):
8
+ def _tex_escape (string ):
11
9
# Work around <https://github.com/matplotlib/matplotlib/issues/15493>
12
- return mpl_common_texification (string ).replace ("&" , "\\ &" )
10
+ return mpl_tex_escape (string ).replace ("&" , "\\ &" )
13
11
14
12
15
13
class Axes :
@@ -42,13 +40,13 @@ def __init__(self, data, obj): # noqa: C901
42
40
title = obj .get_title ()
43
41
data ["current axis title" ] = title
44
42
if title :
45
- title = _common_texification (title )
43
+ title = _tex_escape (title )
46
44
self .axis_options .append (f"title={{{ title } }}" )
47
45
48
46
# get axes titles
49
47
xlabel = obj .get_xlabel ()
50
48
if xlabel :
51
- xlabel = _common_texification (xlabel )
49
+ xlabel = _tex_escape (xlabel )
52
50
53
51
labelcolor = obj .xaxis .label .get_c ()
54
52
@@ -64,7 +62,7 @@ def __init__(self, data, obj): # noqa: C901
64
62
65
63
ylabel = obj .get_ylabel ()
66
64
if ylabel :
67
- ylabel = _common_texification (ylabel )
65
+ ylabel = _tex_escape (ylabel )
68
66
69
67
labelcolor = obj .yaxis .label .get_c ()
70
68
if labelcolor != "black" :
@@ -594,7 +592,7 @@ def _get_ticks(data, xy, ticks, ticklabels):
594
592
label = ticklabel .get_text ()
595
593
if "," in label :
596
594
label = "{" + label + "}"
597
- pgfplots_ticklabels .append (_common_texification (label ))
595
+ pgfplots_ticklabels .append (_tex_escape (label ))
598
596
599
597
# note: ticks may be present even if labels are not, keep them for grid lines
600
598
for tick in ticks :
0 commit comments