Skip to content

Commit 6df24d0

Browse files
authored
Merge pull request nschloe#267 from nighthawk9/fix-mathdefault
Fix mathdefault input into tex file
2 parents 8ef4998 + 05f551c commit 6df24d0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

matplotlib2tikz/axes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
import matplotlib as mpl
44
import numpy
5+
from matplotlib.backends import backend_pgf as mpl_backend_pgf
56

67
from . import color
78

@@ -41,9 +42,11 @@ def __init__(self, data, obj):
4142
# get axes titles
4243
xlabel = obj.get_xlabel()
4344
if xlabel:
45+
xlabel = mpl_backend_pgf.common_texification(xlabel)
4446
self.axis_options.append("xlabel={{{}}}".format(xlabel))
4547
ylabel = obj.get_ylabel()
4648
if ylabel:
49+
ylabel = mpl_backend_pgf.common_texification(ylabel)
4750
self.axis_options.append("ylabel={{{}}}".format(ylabel))
4851

4952
# Axes limits.
@@ -545,6 +548,7 @@ def _get_ticks(data, xy, ticks, ticklabels):
545548
# store the label anyway
546549
label = ticklabel.get_text()
547550
if ticklabel.get_visible():
551+
label = mpl_backend_pgf.common_texification(label)
548552
pgfplots_ticklabels.append(label)
549553
else:
550554
is_label_required = True

0 commit comments

Comments
 (0)