matplotlib locale (language) settings: how to change default ? (e.g. in plot_date labels)

Hi all,

I would like to know how to set locale settings for matplotlib.

When I use the plot_date function, labels are in french (my system’s default locale). I would like english. I tried to set locale and it works ok with strftime :

import locale
print(locale.getlocale())
(‘fr_FR’, ‘UTF-8’)
mydate=dates.datetime.date(1950,1,15)
mydate.strftime(’%A %d %B %Y’)
Out[19]: ‘dimanche 15 janvier 1950’

locale.setlocale(locale.LC_ALL,‘en_US’)
Out[21]: ‘en_US’
mydate.strftime(’%A %d %B %Y’)
Out[22]: ‘Sunday 15 January 1950’

But this has no effect on the plot_date results…

In my mpl.rcParams, ‘axes.formatter.use_locale’ is set to False.

How can I set locale configuration for matplotlib ?

Any advice welcome !

Thank you !

Clement

In my mpl.rcParams, 'axes.formatter.use_locale' is set to False.

Have you tried setting this value to True?

Skip

Yes, I've tried this :
locale.setlocale(locale.LC_ALL,'en_US')
mpl.rcParams['axes.formatter.use_locale'] = True

But it has no effect.

2013/6/3 Skip Montanaro <skip@...789...>

···

> In my mpl.rcParams, 'axes.formatter.use_locale' is set to False.

Have you tried setting this value to True?

Skip

Have you tried setting the `LC_ALL` to `en_US` before starting up Python?

Mike

···

On 06/03/2013 09:10 AM, Cl�ment Mayet wrote:

Yes, I've tried this :
locale.setlocale(locale.LC_ALL,'en_US')
mpl.rcParams['axes.formatter.use_locale'] = True

But it has no effect.

2013/6/3 Skip Montanaro <skip@...789... <mailto:skip@…789…>>

    > In my mpl.rcParams, 'axes.formatter.use_locale' is set to False.

    Have you tried setting this value to True?

    Skip

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options