FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[Bug]: The plot is incorrect for certain data · Issue #23053 · matplotlib/matplotlib · GitHub

Repository navigation

[Bug]: The plot is incorrect for certain data #23053

Closed

Description

Bug summary

The chart is incorrect for a specific number (19.607843137254918). I am not creating this number manually. Instead I get it from a pandas data frame. I have no control over what data I get so I am not sure about what is special about this number that causes a wrong chart.
Please look at the

Code for reproduction

from matplotlib.pyplot import figure
import matplotlib.pyplot as plt

figure(figsize=(8, 6), dpi=100)
plt.plot([19.607843137254903, 19.607843137254903, 19.607843137254903, 19.607843137254903, 19.607843137254903, 19.60784313725489, 19.607843137254918])
plt.show()

Actual outcome

Expected outcome

Please see the Y-Axis of the attached image to see what is wrong. I expect a plot with Y-values around 19. But instead the plot shows 5.5 with a scale that is 1e-11+...

Additional information

No response

Operating system

OS/X

Matplotlib Version

3.5.1

Matplotlib Backend

No response

Python version

Python 3.9.10

Jupyter version

No response

Installation

pip

Activity

  1. WeatherGod commented on May 16, 2022

    Member
  2. jklymak commented on May 16, 2022

    Member

    You can turn this behaviour off with something like ax.get_yaxis().get_major_formatter().set_useOffset(False)

  3. jklymak commented on May 16, 2022

    Member

    Yeah I do wonder if we could make this more straightforward. By the time we are four classes down the tree we have made a feature really hard to discover.

  4. tacaswell commented on May 16, 2022

    Member

    We should move the rcparam version of that higher up and give it a code example.

  5. timhoffm commented on May 16, 2022

    Member

    IMHO we should deactivate this by default. It's useful only if you know that this exists and how it works. If the users really want it they can activate it, otherwise it's just confusing.

  6. anntzer commented on May 16, 2022

    Contributor

    fwiw I have it deactivated in my default matplotlibrc and am always slightly confused when running my code on some other computer that doesn't have it ("ah, I need to unset that explicitly").

  7. jklymak commented on May 17, 2022

    Member

    I'd be good with deactivating.

    I think we could add ax.x/yaxis.set_use_offset to control this on a per-axis basis.

  8. tacaswell commented on May 17, 2022

    Member

    It is my suspicion that defaulting to false will cause approximately the same number of bug reports (in addition to a wave of "this used to work!" bug reports), but am not sure so I'm neutral on this change.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL