Skip to content

Stem is slow and will crash if I try to close the window #7969

Closed

Description

@goldfita

Bug summary

Stem will crash if you try to close the window while it's processing. It's also very slow for what I would consider a relatively small number of data points. I'm using the code from Julia, but I was informed the problem is Matplotlib. See original discusion.

Code for reproduction

using PyPlot
stem(randn(32768))

Actual outcome

This will work if you wait about half a minute. If you interfere by trying to close the window, the application crashes (Julia in this case).

Matplotlib version

I don't know. I'm using the most recent version of PyPlot and PyCall in Julia 0.5. Conda installed Python 2.7.

Activity

  1. tacaswell commented on Jan 28, 2017

    @tacaswell
    Member

    Can you please provide python code that generate the issue? As the julia folks point at us, it is not clear that this is not a bug on the julia side.

  2. added this to the milestone on Jan 28, 2017
  3. goldfita commented on Jan 28, 2017

    @goldfita
    Author

    I tried just now. I'm afraid I'm too much of a beginner with both Julia and Matplotlib to figure this out. However, poster jheinen on the Julia forum claims to have reproduced this problem in pure Python. I suggest asking him for his code. I'm sorry I can't be of any more help. I don't want to get in the middle of any finger pointing between these two communities.

  4. tacaswell commented on Jan 28, 2017

    @tacaswell
    Member

    It is not finger pointing, just sorting out what the actual bug is.

    attn @jheinen

  5. jheinen commented on Jan 28, 2017

    @jheinen
    Contributor

    This is how you can reproduce the bug (in Python)

    import matplotlib.pyplot as plt
    import numpy as np
    plt.stem(np.random.randn(10000))

    Fails on macOS X, can't check other backends before Monday ...

  6. anntzer commented on Jan 28, 2017

    @anntzer
    Contributor

    Indeed, this is likely due to the fact that stem generates one Line2D per stem, rather than grouping everything in a LineCollection, which would probably improve the performance quite a bit.

  7. anntzer commented on Feb 16, 2017

    @anntzer
    Contributor

    (but LineCollection currently cannot take a custom marker :-()

  8. tacaswell commented on Feb 17, 2017

    @tacaswell
    Member

    At a minimum, we could save some time by not going through plot

  9. modified the milestones: , on Aug 14, 2017
  10. dstansby commented on Oct 24, 2017

    @dstansby
    Member

    Having a look at this and think I'm making progress

  11. self-assigned this
    on Oct 24, 2017
  12. terriyu commented on Feb 1, 2018

    @terriyu

    I also confirmed this bug in Python 3 on Ubuntu 16.04. I tried to plot a stem plot with 130,000 points and the computer crunched on it a long time without displaying anything.

  13. grr37213 commented on Aug 16, 2018

    @grr37213

    Since I encountered this problem by plotting around 30000 data points today I found this issue.
    I can only link to this workaround I found, which solved my problem through manually calculating the line, coordinates and plotting a line collection, instead of using stem itself.
    https://stackoverflow.com/questions/48301044/optimization-of-matplotlib-stem-plot
    Maybe it helps someone.

  14. modified the milestones: needs sorting, v3.1.0 on Feb 15, 2019
  15. racinmat commented on May 15, 2019

    @racinmat

    Will this be merged to some 3.0.x version, or do we need to wait for stable 3.1.x version if we want this fixed in pip?

  16. dstansby commented on May 15, 2019

    @dstansby
    Member

    I'm afraid this is only going to be in 3.1.x onwards.

  17. timhoffm commented on May 15, 2019

    @timhoffm
    Member

    But 3.1.0 should hopefully come out soon 😄 .

  18. tacaswell commented on May 15, 2019

    @tacaswell
    Member

    Hopefully today or tomorrow.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions