Skip to content

ScalarFormatter.set_powerlimits documentation seems inconsistent #15376

@cmbant

Description

@cmbant

Bug report

Documentation says:

set_powerlimits(self, lims)[source]
Sets size thresholds for scientific notation.
(min_exp, max_exp)
A tuple containing the powers of 10 that determine the switchover threshold. Numbers below 10**min_exp and above 10**max_exp will be displayed in scientific notation.

However

    sFormatter = matplotlib.ticker.ScalarFormatter(useOffset=False, useMathText=True)
    sFormatter.set_powerlimits((-2, 2))
    plt.plot([120,130,140],[0.03,0.05,0.08])
    plt.gca().xaxis.set_major_formatter(sFormatter)
    plt.gca().yaxis.set_major_formatter(sFormatter)

does use scientific notation on the y axis but not the x axis. The the correct description of the actual behaviour seems to be

A tuple containing the powers of 10 that determine the switchover threshold. Numbers with absolute values below 10**(min_exp+1) and above 10**(max_exp+1) will be displayed in scientific notation.

Or it is a bug (would make more sense if the original description were correct).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions