
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/axes_grid1/simple_axisline4.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. meta::
        :keywords: codex

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_gallery_axes_grid1_simple_axisline4.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_axes_grid1_simple_axisline4.py:


================
Simple Axisline4
================

.. GENERATED FROM PYTHON SOURCE LINES 7-25

.. code-block:: Python

    import matplotlib.pyplot as plt
    import numpy as np

    from mpl_toolkits.axes_grid1 import host_subplot

    ax = host_subplot(111)
    xx = np.arange(0, 2*np.pi, 0.01)
    ax.plot(xx, np.sin(xx))

    ax2 = ax.twin()  # ax2 is responsible for "top" axis and "right" axis
    ax2.set_xticks([0., .5*np.pi, np.pi, 1.5*np.pi, 2*np.pi],
                   labels=["$0$", r"$\frac{1}{2}\pi$",
                           r"$\pi$", r"$\frac{3}{2}\pi$", r"$2\pi$"])

    ax2.axis["right"].major_ticklabels.set_visible(False)
    ax2.axis["top"].major_ticklabels.set_visible(True)

    plt.show()


.. _sphx_glr_download_gallery_axes_grid1_simple_axisline4.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: simple_axisline4.ipynb <simple_axisline4.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: simple_axisline4.py <simple_axisline4.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: simple_axisline4.zip <simple_axisline4.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
