Format y-axis tick labels in 'comma' notation ie 234004 would be 234, 004 etc.

Hi All,

I'm assuming this is possible and common but I'm not finding the correct combination of search terms to find any examples on the mailing list or online on how to do this.

I'd like to display the y-axis tick labels in the 'comma' notation i.e.

234004 = 234,004
1237689 = 1,237,689
etc

thanks,

- dharhas

Python 2.7 has format specifiers for thousands separation:

http://docs.python.org/dev/whatsnew/2.7.html#pep-378-format-specifier-for-thousands-separator

moneyfmt recipe http://docs.python.org/library/decimal.html#recipes
might provide an alternative solution. In any case you should need to
get yticklabels and set them with the converted values.

···

On Tue, Oct 19, 2010 at 1:31 PM, Dharhas Pothina <Dharhas.Pothina@...3115...> wrote:

Hi All,

I'm assuming this is possible and common but I'm not finding the correct combination of search terms to find any examples on the mailing list or online on how to do this.

I'd like to display the y-axis tick labels in the 'comma' notation i.e.

234004 = 234,004
1237689 = 1,237,689
etc

thanks,

- dharhas

--
Gökhan

2010/10/19 Dharhas Pothina <Dharhas.Pothina@...3115...>:

I'm assuming this is possible and common but I'm not finding the correct combination of search terms to find any examples on the mailing list or online on how to do this.

I'd like to display the y-axis tick labels in the 'comma' notation i.e.

234004 = 234,004
1237689 = 1,237,689

You could write your own formatter, don't be scared. The following
might be a good starting point:
http://matplotlib.sourceforge.net/api/ticker_api.html#matplotlib.ticker.FuncFormatter

You just need to write a function inserting the comma into the
number's string repr() given a plain Python number.

If I'm not mistaken this feature has never been requested so far, AFAICT.

Just got Goekhan's message, try a combination of both, might be worth.

hthy,
Friedrich