I was surprised today to notice that “subplot” was the slowest part of some plotting code of mine.
On my machine, the last line of the following code puts ten subplots on a figure and records the amount of time it took to make them:
from matplotlib.pyplot import *
… t = time.time()
… for i in xrange(10):
… return time.time()-t
times = [f() for x in xrange(10)]
This code gives me a bunch of times that are on average about half a second. I expected it to be much faster as I wasn’t actually plotting anything.
Is this expected? Can I choose a faster backend or something? I’ve experimented a little but without success. I realize that 5 hundredths of a second per subplot isn’t terrifically slow, … but I guess I make a lot of plots.
Thanks a lot,