Skip to content

Commit 8b11616

Browse files
author
Gorshanov Vadim
committed
Show the axis name in math mode
1 parent 584153f commit 8b11616

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/tikzplotlib/_axes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ def __init__(self, data, obj): # noqa: C901
5353

5454
labelcolor = obj.xaxis.label.get_c()
5555
xlabel = re.sub(r"\smm", r" \\si{\\mm}", xlabel)
56+
xlabel_spl = xlabel.split(",")
57+
if len(xlabel_spl) == 2:
58+
xlabel = ",".join(["$" + xlabel_spl[0].replace(" ", "\\ ") + "$",
59+
xlabel_spl[1]])
60+
5661
if labelcolor != "black":
5762
data, col, _ = _color.mpl_color2xcolor(data, labelcolor)
5863
self.axis_options.append(f"xlabel=\\textcolor{{{col}}}{{{xlabel}}}")
@@ -67,6 +72,11 @@ def __init__(self, data, obj): # noqa: C901
6772
if ylabel:
6873
ylabel = _common_texification(ylabel)
6974

75+
ylabel_spl = ylabel.split(",")
76+
if len(ylabel_spl) == 2:
77+
ylabel = ",".join(["$" + ylabel_spl[0].replace(" ", "\\ ") + "$",
78+
ylabel_spl[1]])
79+
7080
labelcolor = obj.yaxis.label.get_c()
7181
if labelcolor != "black":
7282
data, col, _ = _color.mpl_color2xcolor(data, labelcolor)

0 commit comments

Comments
 (0)