Skip to content

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

Closed
@manishbajpai

Description

@manishbajpai

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

plot

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

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