3

I know this is actually an often asked question, but I can not find an answer to my specific question.

Is there any possibility to change the displayed decimal separator only in matplotlib?

I don't want to change any settings in locale, since I don't know how this might influence other things as for example pandas.read_csv() or pandas.DataFrame.to_csv(). Or can I just do locale._override_localeconv = {'decimal_point': ','} without influencing other parts in python?

I wonder why I have to set plt.rcParams["axes.formatter.use_locale"] = True explicitely but don't have any possibility to change the matplotlib internal values without using locale.

Thanks...

  • Does this solve your issue https://stackoverflow.com/questions/35929775/how-to-change-point-to-comma-in-matplotlib-graphics/35937196#35937196 ? – tmdavison Jul 01 '22 at 09:44
  • I am not sure if I oversee anything, but this changes the locale, right? I do not want to change the locale since I am not sure if this influences other parts in python (at least I don't know which packages use the locale as well). – AaronSchueddekopf Jul 01 '22 at 11:33
  • `locale._override_localeconv = {'decimal_point': ','} ` will make a global change. I'd be inclined to set `plt.rcParams['axes.formatter.use_locale'] = True` but this has different effects on different platforms. There are a number of different implementations of glibc, and on systems (like macOS) that use bsdlibc, the grouping (thousands) separator is set to an empty string for various locales. For more complex scenarios, I tend to rely on `matplotlib.ticker.FuncFormatter()`. – Andj Apr 21 '23 at 06:38

0 Answers0