You are reading an old version of the documentation (v1.3.0). For the latest version see https://matplotlib.org/stable/
matplotlib

This Page

pylab_examples example code: coords_report.pyΒΆ

(Source code, png, hires.png, pdf)

../../_images/coords_report.png
#!/usr/bin/env python

# override the default reporting of coords

from pylab import *

def millions(x):
    return '$%1.1fM' % (x*1e-6)

x =     rand(20)
y =     1e7*rand(20)

fig, ax = subplots()
ax.fmt_ydata = millions
plot(x, y, 'o')

show()

Keywords: python, matplotlib, pylab, example, codex (see Search examples)