Skip to content

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

Closed

Description

@aaronschueddekopf

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

Activity

  1. added this to the v3.8.1 milestone on Sep 18, 2023
  2. oscargus commented on Sep 18, 2023

    @oscargus
    Member

    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.)

  3. aaronschueddekopf commented on Sep 18, 2023

    @aaronschueddekopf
    Author

    @oscargus that's great! Thanks!

  4. added
    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
    on Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: confirmed bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions