Skip to content
Draft
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
35 changes: 35 additions & 0 deletions galleries/examples/ticks/ticks_top_right.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
=================================
Ticks and labels on top and right
=================================

Demonstrate moving ticks, tick labels, and axis labels
to the top or right side of an Axes.

"""

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.plot(range(10))

# Move ticks and tick labels to the top and right
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()
Loading