

.. _sphx_glr_gallery_pylab_examples_axes_props.py:


==========
Axes Props
==========

You can control the axis tick and grid properties




.. image:: /gallery/pylab_examples/images/sphx_glr_axes_props_001.png
    :align: center





.. code-block:: python


    import matplotlib.pyplot as plt
    import numpy as np

    t = np.arange(0.0, 2.0, 0.01)
    s = np.sin(2 * np.pi * t)
    fig, ax = plt.subplots()
    ax.plot(t, s)
    ax.grid(True)

    ticklines = ax.get_xticklines() + ax.get_yticklines()
    gridlines = ax.get_xgridlines() + ax.get_ygridlines()
    ticklabels = ax.get_xticklabels() + ax.get_yticklabels()

    for line in ticklines:
        line.set_linewidth(3)

    for line in gridlines:
        line.set_linestyle('-.')

    for label in ticklabels:
        label.set_color('r')
        label.set_fontsize('medium')

    plt.show()

**Total running time of the script:** ( 0 minutes  0.039 seconds)



.. container:: sphx-glr-footer


  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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

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

    `Generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
