
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/scales/symlog_demo.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_scales_symlog_demo.py>`
        to download the full example code

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

.. _sphx_glr_gallery_scales_symlog_demo.py:


===========
Symlog Demo
===========

Example use of symlog (symmetric log) axis scaling.

.. GENERATED FROM PYTHON SOURCE LINES 8-36

.. code-block:: Python

    import matplotlib.pyplot as plt
    import numpy as np

    dt = 0.01
    x = np.arange(-50.0, 50.0, dt)
    y = np.arange(0, 100.0, dt)

    fig, (ax0, ax1, ax2) = plt.subplots(nrows=3)

    ax0.plot(x, y)
    ax0.set_xscale('symlog')
    ax0.set_ylabel('symlogx')
    ax0.grid()
    ax0.xaxis.grid(which='minor')  # minor grid on too

    ax1.plot(y, x)
    ax1.set_yscale('symlog')
    ax1.set_ylabel('symlogy')

    ax2.plot(x, np.sin(x / 3.0))
    ax2.set_xscale('symlog')
    ax2.set_yscale('symlog', linthresh=0.015)
    ax2.grid()
    ax2.set_ylabel('symlog both')

    fig.tight_layout()
    plt.show()




.. image-sg:: /gallery/scales/images/sphx_glr_symlog_demo_001.png
   :alt: symlog demo
   :srcset: /gallery/scales/images/sphx_glr_symlog_demo_001.png, /gallery/scales/images/sphx_glr_symlog_demo_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 37-41

It should be noted that the coordinate transform used by ``symlog``
has a discontinuous gradient at the transition between its linear
and logarithmic regions. The ``asinh`` axis scale is an alternative
technique that may avoid visual artifacts caused by these discontinuities.

.. GENERATED FROM PYTHON SOURCE LINES 43-48

.. admonition:: References

   - `matplotlib.scale.SymmetricalLogScale`
   - `matplotlib.ticker.SymmetricalLogLocator`
   - `matplotlib.scale.AsinhScale`


.. _sphx_glr_download_gallery_scales_symlog_demo.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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