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

    Click :ref:`here <sphx_glr_download_gallery_scales_log_test.py>` to download the full example code
.. rst-class:: sphx-glr-example-title

.. _sphx_glr_gallery_scales_log_test.py:


========
Log Axis
========

This is an example of assigning a log-scale for the x-axis using
`semilogx`.




.. image:: /gallery/scales/images/sphx_glr_log_test_001.png
    :class: sphx-glr-single-img





.. code-block:: python


    import matplotlib.pyplot as plt
    import numpy as np

    fig, ax = plt.subplots()

    dt = 0.01
    t = np.arange(dt, 20.0, dt)

    ax.semilogx(t, np.exp(-t / 5.0))
    ax.grid()

    plt.show()


.. _sphx_glr_download_gallery_scales_log_test.py:


.. only :: html

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



  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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


.. only:: html

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

    Keywords: matplotlib code example, codex, python plot, pyplot
    `Gallery generated by Sphinx-Gallery
    <https://sphinx-gallery.readthedocs.io>`_
