Skip to content

FIX: make labelrotation work as kwarg to tick_params as documented #9633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ def _translate_tick_kw(kw, to_init_kw=True):
'tick1On', 'tick2On', 'label1On', 'label2On']
kwkeys1 = ['length', 'direction', 'left', 'bottom', 'right', 'top',
'labelleft', 'labelbottom', 'labelright', 'labeltop',
'rotation']
'labelrotation']
kwkeys = kwkeys0 + kwkeys1
kwtrans = dict()
if to_init_kw:
Expand Down
12 changes: 10 additions & 2 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5201,15 +5201,23 @@ def test_bar_color_cycle():


def test_tick_param_label_rotation():
fix, ax = plt.subplots()
plt.plot([0, 1], [0, 1])
fix, (ax, ax2) = plt.subplots(1, 2)
ax.plot([0, 1], [0, 1])
ax2.plot([0, 1], [0, 1])
ax.xaxis.set_tick_params(which='both', rotation=75)
ax.yaxis.set_tick_params(which='both', rotation=90)
for text in ax.get_xticklabels(which='both'):
assert text.get_rotation() == 75
for text in ax.get_yticklabels(which='both'):
assert text.get_rotation() == 90

ax2.tick_params(axis='x', labelrotation=53)
ax2.tick_params(axis='y', rotation=35)
for text in ax2.get_xticklabels(which='major'):
assert text.get_rotation() == 53
for text in ax2.get_yticklabels(which='major'):
assert text.get_rotation() == 35


@pytest.mark.style('default')
def test_fillbetween_cycle():
Expand Down