Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Document how to use mathtext to obtain unicode minus instead of dashes for negative numbers #17967

Closed
@Atcold

Description

@Atcold

When using FormatStrFormatter on the x-axis, the negative numbers have a dash - in front instead of a minus −.

θ = linspace(-1.5, 0) * 2 * π
y = sin(θ)
plot(θ / π, y)
gca().xaxis.set_major_formatter(FormatStrFormatter('%g π'))

-sine-π

Without the formatter, all looks good.

x = linspace(-1.5, 0)
y = sin(x * 2 * π)
plot(x, y)

-sine

I'm wondering who's handling the conversion of the dash into a minus, and how to recreate that when using FormatStrFormatter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationGood first issueOpen a pull request against these issues if there are no active ones!

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions