Matplotlib.pyplot.hist() very slow

前端 未结 8 2011
孤独总比滥情好
孤独总比滥情好 2021-01-11 11:37

I\'m plotting about 10,000 items in an array. They are of around 1,000 unique values.

The plotting has been running half an hour now. I made sure rest of the code wo

相关标签:
8条回答
  • 2021-01-11 12:27

    For me it took calling figure.canvas.draw() after the call to hist to update immediately, i.e. hist was actually fast (discovered that after timing it), but there was a delay of a few seconds before figure was updated. I was calling hist inside a matplotlib callback in a jupyter lab cell (qt5 backend).

    0 讨论(0)
  • 2021-01-11 12:29

    Anyone running into the issue I had - (which is totally my bad :) )

    If you're dealing with numbers, make sure when reading from CSV that your datatype is int/float, and not string.

    values_arr = .... .flatten().astype('float')
    
    0 讨论(0)
提交回复
热议问题