Skip to content

Repeated calls to scatter with identical data produce different axis limits #15955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mwaskom opened this issue Dec 17, 2019 · 2 comments
Closed
Milestone

Comments

@mwaskom
Copy link

mwaskom commented Dec 17, 2019

Bug report

Bug summary

In trying to debug some tests, I discovered some strange behavior. I'm not certain it's a bug, but I can't really think of an explanation for it, so I'm reporting.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

f, ax = plt.subplots()
x, y = np.random.randn(2, 50)
ax.scatter(x, y)
xlim = ax.get_xlim()
ax.scatter(x, y)
print(xlim == ax.get_xlim())

Actual outcome

False

Expected outcome

True

Other observations

It appears to be scatter dependent. If I replace both calls to scatter with plot, it passes. Calling scatter then plot passes, but calling plot then scatter fails.

Matplotlib version

  • Operating system: MacOS
  • Matplotlib version: '3.1.1'
  • Matplotlib backend (print(matplotlib.get_backend())): notebook inline, reproduces on Agg
  • Python version: 3.7
@ImportanceOfBeingErnest
Copy link
Member

The issue is #7413, part of which is fixed by #13642. Hence the above code will result in True in matplotlib 3.2.

@mwaskom
Copy link
Author

mwaskom commented Dec 17, 2019

Great!

@mwaskom mwaskom closed this as completed Dec 17, 2019
@QuLogic QuLogic added this to the v3.2.0 milestone Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants