.. only:: html
.. note::
:class: sphx-glr-download-link-note
Click :ref:`here ` to download the full example code
.. rst-class:: sphx-glr-example-title
.. _sphx_glr_gallery_ticks_and_spines_tick_label_right.py:
============================================
Set default y-axis tick labels on the right
============================================
We can use :rc:`ytick.labelright` (default False) and :rc:`ytick.right`
(default False) and :rc:`ytick.labelleft` (default True) and :rc:`ytick.left`
(default True) to control where on the axes ticks and their labels appear.
These properties can also be set in the ``.matplotlib/matplotlibrc``.
.. image:: /gallery/ticks_and_spines/images/sphx_glr_tick_label_right_001.png
:alt: tick label right
:class: sphx-glr-single-img
.. code-block:: default
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['ytick.right'] = plt.rcParams['ytick.labelright'] = True
plt.rcParams['ytick.left'] = plt.rcParams['ytick.labelleft'] = False
x = np.arange(10)
fig, (ax0, ax1) = plt.subplots(2, 1, sharex=True, figsize=(6, 6))
ax0.plot(x)
ax0.yaxis.tick_left()
# use default parameter in rcParams, not calling tick_right()
ax1.plot(x)
plt.show()
.. _sphx_glr_download_gallery_ticks_and_spines_tick_label_right.py:
.. only :: html
.. container:: sphx-glr-footer
:class: sphx-glr-footer-example
.. container:: sphx-glr-download sphx-glr-download-python
:download:`Download Python source code: tick_label_right.py `
.. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: tick_label_right.ipynb `
.. only:: html
.. rst-class:: sphx-glr-signature
Keywords: matplotlib code example, codex, python plot, pyplot
`Gallery generated by Sphinx-Gallery
`_