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

    Click :ref:`here <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
=============

You can use the proper typesetting `Unicode minus`__ or the ASCII hyphen for
minus, which some people prefer.  :rc:`axes.unicode_minus` controls the default
behavior.

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

The default is to use the Unicode minus.




.. image:: /gallery/text_labels_and_annotations/images/sphx_glr_unicode_minus_001.png
    :class: sphx-glr-single-img





.. code-block:: python


    import numpy as np
    import matplotlib
    import matplotlib.pyplot as plt

    # Fixing random state for reproducibility
    np.random.seed(19680801)


    matplotlib.rcParams['axes.unicode_minus'] = False
    fig, ax = plt.subplots()
    ax.plot(10*np.random.randn(100), 10*np.random.randn(100), 'o')
    ax.set_title('Using hyphen instead of Unicode minus')
    plt.show()


.. _sphx_glr_download_gallery_text_labels_and_annotations_unicode_minus.py:


.. only :: html

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



  .. container:: sphx-glr-download

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



  .. container:: sphx-glr-download

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