Skip to content

Commit 0809419

Browse files
authored
Merge pull request nschloe#304 from satejsoman/label-rotation
Support axis title rotation
2 parents 3dc20b8 + 3fcd02b commit 0809419

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

matplotlib2tikz/axes.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,23 @@ def __init__(self, data, obj):
4242

4343
# get axes titles
4444
xlabel = obj.get_xlabel()
45+
xrotation = obj.xaxis.get_label().get_rotation()
4546
if xlabel:
4647
xlabel = mpl_backend_pgf.common_texification(xlabel)
4748
self.axis_options.append(u"xlabel={{{}}}".format(xlabel))
49+
if xrotation != 0:
50+
self.axis_options.append(
51+
u"xlabel style={{rotate={}}}".format(xrotation - 90)
52+
)
4853
ylabel = obj.get_ylabel()
54+
yrotation = obj.yaxis.get_label().get_rotation()
4955
if ylabel:
5056
ylabel = mpl_backend_pgf.common_texification(ylabel)
5157
self.axis_options.append(u"ylabel={{{}}}".format(ylabel))
58+
if yrotation != 90:
59+
self.axis_options.append(
60+
u"ylabel style={{rotate={}}}".format(yrotation - 90)
61+
)
5262

5363
# Axes limits.
5464
# Sort the limits so make sure that the smaller of the two is actually *min.

0 commit comments

Comments
 (0)