8000 empty imshow crashes python · Issue #7886 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
empty imshow crashes python #7886
Closed
Closed
@tacaswell

Description

@tacaswell

To help us understand and resolve your issue, please fill out the form to the best of your ability. You can feel free to delete the sections that do not apply.

Bug report

Bug summary

  • A short 1-2 sentences that succinctly describes the bug

An empty array in imshow + an extent crashes

Code for reproduction

  • A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required
import matplotlib.pyplot as plt
plt.ioff()
fig, ax = plt.subplots()
im = ax.imshow([[]])
im.set_extent([-5, 5, -5, 5])
fig.canvas.draw()

Actual outcome

  • The output produced by the above code, which may be a screenshot, console output, etc.
22:51 $ python /tmp/st.py 
/home/tcaswell/src/p/matplotlib/lib/matplotlib/axes/_base.py:2903: UserWarning: Attempting to set identical left==right results
in singular transformations; automatically expanding.
left=-0.5, right=-0.5
  'left=%s, right=%s') % (left, right))
/home/tcaswell/src/p/matplotlib/lib/matplotlib/image.py:327: RuntimeWarning: divide by zero encountered in double_scalars
  in_bbox.width / A.shape[1],
Floating point exception (core dumped)

Expected outcome

  • A description of the expected outcome from the code snippet
    not crash

  • If this used to work in an earlier version of Matplotlib, please note the version it used to work on
    1.5.3 (reportedly, not verified)

  • Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
    py3.6, pyqt4, linux.

  • How did you install Matplotlib and Python (pip, anaconda, from source ...)
    source 😈

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0