
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "gallery/ticks_and_spines/scalarformatter.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

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

        Click :ref:`here <sphx_glr_download_gallery_ticks_and_spines_scalarformatter.py>`
        to download the full example code

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

.. _sphx_glr_gallery_ticks_and_spines_scalarformatter.py:


==========================
The default tick formatter
==========================

The example shows use of the default `.ScalarFormatter` with different
settings.

Example 1 : Default

Example 2 : With no Numerical Offset

Example 3 : With Mathtext

.. GENERATED FROM PYTHON SOURCE LINES 15-19

.. code-block:: default


    import matplotlib.pyplot as plt
    import numpy as np








.. GENERATED FROM PYTHON SOURCE LINES 20-21

Example 1

.. GENERATED FROM PYTHON SOURCE LINES 21-38

.. code-block:: default


    x = np.arange(0, 1, .01)
    fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
    fig.text(0.5, 0.975, 'Default settings',
             horizontalalignment='center',
             verticalalignment='top')

    ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5)

    ax2.plot(x * 1e5, x * 1e-4)

    ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10)

    ax4.plot(-x * 1e5, -x * 1e-4)

    fig.subplots_adjust(wspace=0.7, hspace=0.6)




.. image:: /gallery/ticks_and_spines/images/sphx_glr_scalarformatter_001.png
    :alt: scalarformatter
    :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 39-40

Example 2

.. GENERATED FROM PYTHON SOURCE LINES 40-61

.. code-block:: default


    x = np.arange(0, 1, .01)
    fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
    fig.text(0.5, 0.975, 'No numerical offset',
             horizontalalignment='center',
             verticalalignment='top')

    ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5)
    ax1.ticklabel_format(useOffset=False)

    ax2.plot(x * 1e5, x * 1e-4)
    ax2.ticklabel_format(useOffset=False)

    ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10)
    ax3.ticklabel_format(useOffset=False)

    ax4.plot(-x * 1e5, -x * 1e-4)
    ax4.ticklabel_format(useOffset=False)

    fig.subplots_adjust(wspace=0.7, hspace=0.6)




.. image:: /gallery/ticks_and_spines/images/sphx_glr_scalarformatter_002.png
    :alt: scalarformatter
    :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 62-63

Example 3

.. GENERATED FROM PYTHON SOURCE LINES 63-85

.. code-block:: default


    x = np.arange(0, 1, .01)
    fig, [[ax1, ax2], [ax3, ax4]] = plt.subplots(2, 2, figsize=(6, 6))
    fig.text(0.5, 0.975, 'With mathtext',
             horizontalalignment='center',
             verticalalignment='top')

    ax1.plot(x * 1e5 + 1e10, x * 1e-10 + 1e-5)
    ax1.ticklabel_format(useMathText=True)

    ax2.plot(x * 1e5, x * 1e-4)
    ax2.ticklabel_format(useMathText=True)

    ax3.plot(-x * 1e5 - 1e10, -x * 1e-5 - 1e-10)
    ax3.ticklabel_format(useMathText=True)

    ax4.plot(-x * 1e5, -x * 1e-4)
    ax4.ticklabel_format(useMathText=True)

    fig.subplots_adjust(wspace=0.7, hspace=0.6)

    plt.show()



.. image:: /gallery/ticks_and_spines/images/sphx_glr_scalarformatter_003.png
    :alt: scalarformatter
    :class: sphx-glr-single-img






.. rst-class:: sphx-glr-timing

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


.. _sphx_glr_download_gallery_ticks_and_spines_scalarformatter.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: scalarformatter.py <scalarformatter.py>`



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

     :download:`Download Jupyter notebook: scalarformatter.ipynb <scalarformatter.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>`_
