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 to in
or out
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 as tick_params
for top and bottom are both tied to the x-axis. I am currently able to accomplish what I want by using and ax.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([])