{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Move x/y-axis ticks and labels on top and right\n\n`.axes.Axes.tick_params` can be used to move tick marks and tick labels\nto the top or right side of the Axes::\n\n    ax.tick_params(top=True, labeltop=True, bottom=False, labelbottom=False)\n    ax.tick_params(right=True, labelright=True, left=False, labelleft=False)\n\nTo also reposition the axes labels (xlabel/ylabel), use\n``Axes.xaxis.set_label_position`` and ``Axes.yaxis.set_label_position``.\n\n<div class=\"alert alert-info\"><h4>Note</h4><p>To apply this globally for all future plots, set the rcParams:\n\n    - :rc:`xtick.top`\n    - :rc:`xtick.labeltop`\n    - :rc:`xtick.bottom`\n    - :rc:`xtick.labelbottom`\n    - :rc:`ytick.right`\n    - :rc:`ytick.labelright`\n    - :rc:`ytick.left`\n    - :rc:`ytick.labelleft`</p></div>\n\n.. redirect-from:: /gallery/ticks/tick_xlabel_top\n.. redirect-from:: /gallery/ticks/tick_label_right\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\n\nfig, ax = plt.subplots()\nax.plot(range(10))\n\n# Move ticks marks and tick labels\nax.tick_params(\n    top=True, labeltop=True,\n    bottom=False, labelbottom=False,\n    right=True, labelright=True,\n    left=False, labelleft=False,\n)\n\n# Move axis labels\nax.xaxis.set_label_position(\"top\")\nax.yaxis.set_label_position(\"right\")\n\nax.set_xlabel(\"X label\")\nax.set_ylabel(\"Y label\")\n\nplt.show()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.14.7"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}