Skip to content

[Bug]: use_locale leads to curly brackets around decimal separator #26803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aaronschueddekopf opened this issue Sep 18, 2023 · 2 comments · Fixed by #26804
Closed

[Bug]: use_locale leads to curly brackets around decimal separator #26803

aaronschueddekopf opened this issue Sep 18, 2023 · 2 comments · Fixed by #26804
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. status: confirmed bug
Milestone

Comments

@aaronschueddekopf
Copy link

Bug summary

If I set plt.rcParams["axes.formatter.use_locale"] = True, the decimal separator is displayed in curly brackets in v3.8.0. This was not the case in 3.7.3. But only when the decimal separator is a comma.

Code for reproduction

import matplotlib.pyplot as plt
import locale

locale.setlocale(locale.LC_NUMERIC, 'de')

plt.rcParams["axes.formatter.use_locale"] = True
fig = plt.Figure()
plt.plot([0, 1, 2, 3, 4], [0.1, 0.13, 0.09, 0.105, 0.13])

Actual outcome

image

Expected outcome

As described in the bug description, in v 3.7.3 this simply led to a comma as decimal separator which is not displayed in curly brackets

Additional information

No response

Operating system

Windows 11

Matplotlib Version

3.8.0

Matplotlib Backend

Qt5Agg

Python version

3.10.11

Jupyter version

No response

Installation

pip

@oscargus oscargus added this to the v3.8.1 milestone Sep 18, 2023
@oscargus
Copy link
Member

oscargus commented Sep 18, 2023

Ahh, as a work-around for now you can use mathtext for the formatter by adding:

plt.rcParams["axes.formatter.use_mathtext"] = True

(This is also a hint for fixing the bug. Curly brackets should only be added if mathtext is used.)

@aaronschueddekopf
Copy link
Author

@oscargus that's great! Thanks!

@rcomer rcomer added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. status: confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants