8000 incorrect default limits 'log' scale depending on order of scatter · Issue #11198 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
incorrect default limits 'log' scale depending on order of scatter #11198
Closed
@lboogaard

Description

@lboogaard

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0