Hi all,

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:

import matplotlib

matplotlib.use(‘AGG’)

import time

from matplotlib.pyplot import *

def f():

… t = time.time()

… clf()

… for i in xrange(10):

… subplot(5,2,i+1)

… 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,

Eddie Schlafly