Note
Go to the endto download the full example code.
Coords Report#
Override the default reporting of coords as the mouse moves over the Axesin an interactive backend.

importmatplotlib.pyplotaspltimportnumpyasnpdefmillions(x):return'$%1.1fM'%(x*1e-6)# Fixing random state for reproducibilitynp.random.seed(19680801)x=np.random.rand(20)y=1e7*np.random.rand(20)fig,ax=plt.subplots()ax.fmt_ydata=millionsplt.plot(x,y,'o')plt.show()