Move x/y-axis ticks and labels on top and right
axes.Axes.tick_params can be used to move tick marks and tick labels
to the top or right side of the Axes:
ax.tick_params(top=True, labeltop=True, bottom=False,
axes.Axes.tick_params can be used to move tick marks and tick labels
to the top or right side of the Axes:
ax.tick_params(top=True, labeltop=True, bottom=False,
To also reposition the axes labels (xlabel/ylabel), use
Axes.xaxis.set_label_position and Axes.yaxis.set_label_position.

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot(range(10))
# Move ticks marks and tick labels
ax.tick_params(
top=True, labeltop=True,
bottom=False, labelbottom=False,
right=True, labelright=True,
left=False, labelleft=False,
)
# Move axis labels
ax.xaxis.set_label_position("top")
ax.yaxis.set_label_position("right")
ax.set_xlabel("X label")
ax.set_ylabel("Y label")
plt.show()