On Thu, May 31, 2012 at 9:31 AM, Mark Bakker <mark...@gmail.com> wrote:

> I looked at the example of overriding the default reporting of coords,
> which is here:
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/coords_report.html
>
> from pylab import *
>
> def millions(x):
> return '$%1.1fM' % (x*1e-6)
>
> x = rand(20)
> y = 1e7*rand(20)
>
> ax = subplot(111)
> ax.fmt_ydata = millions
> plot(x, y, 'o')
>
> show()
>
> I don't understand what the millions function does (with a $ and M ?).
> In fact, I get the exact same result when I delete the line
>
> ax.fmt_ydata = millions
>
> Any thoughts?
>

Hi Mark,

It's a bit confusing, but there's actually two different types of
formatters. You're most likely looking for major/minor tick formatters (
example<http://matplotlib.sourceforge.net/examples/api/engineering_formatter.html>).
In the above example, the *cursor coordinate* is reformatted. In an
interactive window, you should see the current cursor position in the lower
left (this may depend on the backend)---that's the value that should be
reformatted by the `millions` function.

Best,
-Tony
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to