

.. _sphx_glr_gallery_api_unicode_minus.py:


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

You can use the proper typesetting Unicode minus (see
https://en.wikipedia.org/wiki/Plus_sign#Plus_sign) or the ASCII hyphen
for minus, which some people prefer.  The matplotlibrc param
axes.unicode_minus controls the default behavior.

The default is to use the Unicode minus.




.. image:: /gallery/api/images/sphx_glr_unicode_minus_001.png
    :align: center





.. 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()

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



.. container:: sphx-glr-footer


  .. 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>`

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

    `Generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
