.. 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 ` 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 .. image-sg:: /gallery/axes_grid1/images/sphx_glr_simple_axisline4_001.png :alt: simple axisline4 :srcset: /gallery/axes_grid1/images/sphx_glr_simple_axisline4_001.png, /gallery/axes_grid1/images/sphx_glr_simple_axisline4_001_2_00x.png 2.00x :class: sphx-glr-single-img .. 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 ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: simple_axisline4.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_