GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — set_xlim() crashes kernel if interpolation='none' · Issue #3091 · matplotlib/matplotlib

set_xlim() crashes kernel if interpolation='none' #3091

New issue
Copy link
New issue
Copy link
Closed
#3102
Closed
set_xlim() crashes kernel if interpolation='none'#3091
#3102
Copy link
Labels
status: confirmed bug
Milestone
v1.4.0

Description

@bennettbrowniowa
bennettbrowniowa
opened on May 27, 2014
Issue body actions

Using matplotlib 1.3.1-3, the following code causes my Python kernel to crash.

img = plt.imread("cat.png")
fig, ax = plt.subplots(1, 3)
ax[0].imshow(img, interpolation='none')
ax[0].set_xlim(135,165) # larger than image
fig.show()

Activity

  1. Tillsten commented on May 27, 2014

    @Tillsten
    Tillsten
    on May 27, 2014
    Contributor
    More actions

    Cannot reproduce, backend?

  2. bennettbrowniowa commented on May 27, 2014

    @bennettbrowniowa
    bennettbrowniowa
    on May 27, 2014
    Author
    More actions

    I was using Canopy from Enthought with the Qt backend. I reproduced it from the Windows run command line.

    Bennett Brown
    Director of Instruction, Computer Science
    Project Lead The Way, Inc.
    3939 Priority Way South Drive, Suite 200
    Indianapolis, IN 46240
    phone: 317.669.0847
    fax: 317.663.8296
    www.pltw.orghttp://www.pltw.org/
    PLTW | Launch
    Amazing discoveries start herehttp://www.youtube.com/watch?v=jEiBf33RM3s.
    Learn more and register for PLTW Launch today at pltw.org/launchhttp://www.pltw.org/launch.
    Confidentiality Notice: The information transmitted is the property of the sender and is intended only for the person or entity to which it is addressed and may contain confidential and or privileged material. Statements and opinions expressed in this e-mail may not represent those of Project Lead The Way, Inc. Any unauthorized review, retransmission, dissemination and other use of, or taking of any action in reliance upon, this information is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and delete the material from any computer. If you are the intended recipient but do not wish to receive communications through this medium, please so advise the sender immediately.

    From: Till Stensitzki [mailto:[email protected]]
    Sent: Tuesday, May 27, 2014 7:01 PM
    To: matplotlib/matplotlib
    Cc: Bennett Brown
    Subject: Re: [matplotlib] set_xlim() crashes kernel if interpolation='none' (#3091)

    Cannot reproduce, backend?

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/3091#issuecomment-44346335.

  3. Tillsten commented on May 27, 2014

    @Tillsten
    Tillsten
    on May 27, 2014
    Contributor
    More actions

    Could you try to replace your img with just img = np.random.rand(50, 50)? Because i still can't reproduce it, maybe imshow isn't the culprit.

  4. bennettbrowniowa commented on May 28, 2014

    @bennettbrowniowa
    bennettbrowniowa
    on May 28, 2014
    Author
    More actions

    With the Qt4 backend, I do get the error with the 50x50 random array. I do not get the error if I change the value of the second argument of set_xlim() from 185 to 265.

    img = np.random.rand(50, 50)
    fig, ax = plt.subplots(1, 1)
    ax.imshow(img, interpolation='none')
    ax.set_xlim(165,185)
    fig.show()

  5. efiring
    added
    confirmed bug
    on May 28, 2014
  6. efiring commented on May 28, 2014

    @efiring
    efiring
    on May 28, 2014
    Member
    More actions

    I have reproduced this on a Mac with Anaconda, qt4agg backend, and with mpl master on linux, qt4agg, tkagg, and plain agg backends; therefore it is not gui-related. In all cases, the reported error is "Floating point exception".

    On Linux, gdb opened the core file with:
    Program terminated with signal 8, Arithmetic exception.
    #0 0x00007f88db1ab275 in wrap_mode_reflect (size=0, this=0x7fffa49de274)
    at extern/agg24/include/agg_image_accessors.h:379
    379 m_value(0)

    relevant part of the backtrace is:
    #0 0x00007f88db1ab275 in wrap_mode_reflect (size=0, this=0x7fffa49de274)
    at extern/agg24/include/agg_image_accessors.h:379
    #1 image_accessor_wrap (pixf=..., this=0x7fffa49de260)
    at extern/agg24/include/agg_image_accessors.h:244
    #2 Image::resize (this=0x203a150, args=..., kwargs=...) at src/_image.cpp:439
    #3 0x00007f88db1adfe5 in Py::PythonExtension::method_keyword_call_handler (
    _self_and_name_tuple=, _args=, _keywords=)
    at extern/CXX/Python2/ExtensionOldType.hxx:321

  7. efiring commented on May 28, 2014

    @efiring
    efiring
    on May 28, 2014
    Member
    More actions

    Reproduce with a script with the following:

    import numpy as np
    import matplotlib as mpl
    mpl.use('agg')
    import matplotlib.pyplot as plt
    img = np.random.rand(50, 50)
    fig, ax = plt.subplots(1, 1)
    ax.imshow(img, interpolation='none')
    ax.set_xlim(165,185)
    plt.draw()

    As noted by @bennettbrowniowa, it doesn't crash for all values; but as a simpler example that does crash, use np.random.rand(5, 5) and ax.set_xlim(10, 12). Change that last to (10, 15) and it doesn't crash.

  8. Tillsten commented on May 28, 2014

    @Tillsten
    Tillsten
    on May 28, 2014
    Contributor
    More actions

    Maybe this helps people with more knowledge:

    The crash happens while calling the image.resize() method in _image.cpp.
    The python call to it happens in image.py line 326: im.resize(numcols, numrows).
    Note that im.get_size() returns (50, 0).

    `

  9. Tillsten commented on May 28, 2014

    @Tillsten
    Tillsten
    on May 28, 2014
    Contributor
    More actions

    Oh sorry, i overlooked @efiring first post.

  10. tacaswell
    added this to the v1.4.0 milestone on May 28, 2014
  11. efiring commented on May 28, 2014

    @efiring
    efiring
    on May 28, 2014
    Member
    More actions

    @Tillsten, no worries, you added useful information.

    @leejjoon or @mdboom, any chance either of you could take a look at this soon? I suspect a sanity check in an Image method would provide the quickest fix; backing it up with a sanity check in _image.cpp could wait.
    AxesImage.make_image is checking for invalid numrows, numcols, but _AxesBase._draw_unsampled_image is not, and this is where the crash is being triggered.

  12. efiring
    added a commit that references this issue on Jun 1, 2014

    Image: handle images with zero columns or rows.

    This issue will close once commit 60cc436 is merged into the 'main' branch.
    60cc436
  13. tacaswell
    closed this as completedin #3102on Jun 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: confirmed bug

    Type

    No type

    Projects

    No projects

      Milestone

      • v1.4.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.