You are reading an old version of the documentation (v3.1.1). For the latest version see
Version 3.1.2
Fork me on GitHub

Related Topics

Unicode minusΒΆ

You can use the proper typesetting Unicode minus or the ASCII hyphen for minus, which some people prefer. rcParams["axes.unicode_minus"] = True controls the default behavior.

The default is to use the Unicode minus.

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

# Fixing random state for reproducibility

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')

Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery