Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed as not planned
Closed as not planned

Description
matplotlib.axes.Axes.tick_params
allows one to control the direction which the ticks along the x and y axes point. Currently this can either be set toin
orout
which is very useful, but sometimes I want to create a plot that has ticks along the bottom pointing out and ticks along the top pointing in and I was unable to find an easy solution to accomplish this astick_params
for top and bottom are both tied to the x-axis. I am currently able to accomplish what I want by using andax.twiny()
:
fig, ax = plt.subplots()majorLocator = AutoLocator()minorLocator = AutoMinorLocator()ax_top = ax.twiny()ax_top.tick_params(which='both', direction='in')ax_top.set_xlim(ax.get_xlim())ax.xaxis.set_minor_locator(minorLocator)ax.xaxis.set_major_locator(majorLocator)ax_top.xaxis.set_minor_locator(minorLocator)ax_top.xaxis.set_major_locator(majorLocator)ax_top.get_shared_x_axes().join(ax_top, ax)ax_top.set_xticklabels([])