Skip to content

incorrect default limits 'log' scale depending on order of scatter #11198

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
lboogaard opened this issue May 8, 2018 · 4 comments
Closed

incorrect default limits 'log' scale depending on order of scatter #11198

lboogaard opened this issue May 8, 2018 · 4 comments

Comments

@lboogaard
Copy link
Contributor

lboogaard commented May 8, 2018

Bug report

Bug summary

After setting scale to 'log' the default limits can cut off datapoints depending on the order of plotting.

Note: calling set_xscale/set_yscale before calling scatter does not reproduce this bug.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

# smallest span
x1 = np.array([1, 10])
y1 = np.array([10, 1])

# largest span
x2 = np.array([0.1, 100])
y2 = np.array([100, 0.1])

fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2,2, figsize=(8,8))

ax1.scatter(x1, y1)
ax1.scatter(x2, y2)
ax1.set_title('linear; smallest span first', color='g')

ax2.scatter(x1, y1)
ax2.scatter(x2, y2)
ax2.set_xscale('log')
ax2.set_yscale('log')
ax2.set_title('log; smallest span first', color='r')

ax3.scatter(x2, y2)
ax3.scatter(x1, y1)
ax3.set_title('linear; largest span first', color='g')

ax4.scatter(x2, y2)
ax4.scatter(x1, y1)
ax4.set_xscale('log')
ax4.set_yscale('log')
ax4.set_title('log; largest span first', color='g')

Outcome
log-order-bug

Matplotlib version

  • Matplotlib version: 2.2.2
  • Matplotlib backend: MacOSX
  • Python version: 2.7.14 and 3.6.4
@ImportanceOfBeingErnest
Copy link
Member

Does this depend on plotting a scatter or would it occur for a line plot as well?

@lboogaard
Copy link
Contributor Author

It doesn't occur for a line plot; calling ax.plot instead of ax.scatter rescales correctly.

@ImportanceOfBeingErnest
Copy link
Member

I think this is a duplicate of #6915 and the cause is No.2 in #7413.
... which is still unsolved though.

@anntzer
Copy link
Contributor

anntzer commented May 8, 2018

I agree it's a duplicate (for an important issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants