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

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

.. _sphx_glr_gallery_text_labels_and_annotations_unicode_minus.py:


=============
Unicode minus
=============

By default, tick labels at negative values are rendered using a `Unicode
minus`__ (U+2212) rather than an ASCII hyphen (U+002D).  This can be controlled
by setting :rc:`axes.unicode_minus`.

__ https://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes

The replacement is performed at draw time of the tick labels (usually during a
`.pyplot.show()` or `.pyplot.savefig()` call). Therefore, all tick labels of
the figure follow the same setting and we cannot demonstrate both glyphs on
real tick labels of the same figure simultaneously.

Instead, this example simply showcases the difference between the two glyphs
in a magnified font.

.. GENERATED FROM PYTHON SOURCE LINES 20-29



.. image-sg:: /gallery/text_labels_and_annotations/images/sphx_glr_unicode_minus_001.png
   :alt: unicode minus
   :srcset: /gallery/text_labels_and_annotations/images/sphx_glr_unicode_minus_001.png, /gallery/text_labels_and_annotations/images/sphx_glr_unicode_minus_001_2_00x.png 2.00x
   :class: sphx-glr-single-img





.. code-block:: Python


    import matplotlib.pyplot as plt

    fig = plt.figure(figsize=(4, 2))
    fig.text(.15, .6, "Unicode minus:", fontsize=20)
    fig.text(.85, .6, "\N{MINUS SIGN}1", ha='right', fontsize=20)
    fig.text(.15, .3, "ASCII hyphen:", fontsize=20)
    fig.text(.85, .3, "-1", ha='right', fontsize=20)
    plt.show()


.. _sphx_glr_download_gallery_text_labels_and_annotations_unicode_minus.py:

.. only:: html

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

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

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

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

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

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

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


.. only:: html

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

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