Skip to content

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

@mwaskom

Description

@mwaskom

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy