I had a piece of code working perfectly fine with matplotlib 0.87.2.
Now I updated to 0.87.3 and it is about 100 times slower (!).
The code shows a PNG image using axes.imshow.
from pylab import *
from time import asctime, time
ax = fh.add_subplot(111)
print 'Image intepolation = %s' % rcParams['image.interpolation']
print 'Image aspect = %s' % rcParams['image.aspect']
print 'Date/Time = %s' % asctime()
print "Starting Image.open"
image = Image.open(PNG_file)
print "Image.open terminated"
print "Starting imshow"
print "imshow terminated"
print 'Execution time [s] = %4.2f' % (t2-t1)
I tried to create a patch but couldn't understand internal details of
matplotlib, so here are the directions:
1 - The offending part is imshow. (not PIL Image.open)
2 - 0.87.3 imshow has some new code:
if vmin is not None or vmax is not None:
As I do not call imshow with vmax neither vmin this will always fall
into the else clause and call im.autoscale, that is the offending part
Commenting im.autoscale() call makes it fast again, but i don't know
if this is right.
My image is 25K and 2400x1800 black and white PNG. I can send it...
I tried using aspect as 'normal', 'equal' and 'auto' but none had
performance as good as mpl 0.87.2.
Matplotlib 0.87.2 showed figure in less than 0.5 sec, 0.87.3 in about 45 sec.
Should I file a bug report?