Note
Click here to download the full example code
Override the default reporting of coords.
Traceback (most recent call last):
File "/build/matplotlib-tq5J6U/matplotlib-3.1.2/examples/misc/coords_report.py", line 1
=============
^
SyntaxError: invalid syntax
=============
Coords Report
=============
Override the default reporting of coords.
"""
import matplotlib.pyplot as plt
import numpy as np
def millions(x):
return '$%1.1fM' % (x*1e-6)
# Fixing random state for reproducibility
np.random.seed(19680801)
x = np.random.rand(20)
y = 1e7*np.random.rand(20)
fig, ax = plt.subplots()
ax.fmt_ydata = millions
plt.plot(x, y, 'o')
plt.show()
Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery