|
From: John H. <jdh...@ac...> - 2006-02-21 14:28:00
|
>>>>> "Tom" == Tom Denniston <tom...@al...> writes:
Tom> I am generating a few hundred graphs and doing so takes on
Tom> the order of about 10-15 minutes. Which seems to me rather
Tom> slow. When I profile my code it identifies the calls to
Tom> get_yticklabels and get_xticklabels as taking over 90% of the
Tom> time. This seems strange but my calls to these functions are
Tom> merely a sort round about way of setting the font size of the
Tom> axis tick labels and suppressing the text for the
Tom> xticklabels. Is there a more efficient and cleaner way to do
Tom> this? artist.setp(axes.get_yticklabels(), visible=True,
Tom> fontsize=7) artist.setp(axes.get_xticklabels(),
Tom> visible=False)
This is a known performance bottleneck. There are two reasons it is
slow. Every tick label is handled as an independent object, when they
in most cases share most of their properties (font size, orientation)
and so could be better handled as a TextCollection, which does not
exist yet. The second reason is that the text layout engine is doing
layout for newline separated strings with an arbitrary rotation for
every tick label, which is almost never used. So some special case
optimizations to handle the no rotation, no newline text instances
(basically just bypass the layout machinery) would help a lot here.
Are you using matplotlib mathtext also, by chance? This slows things
down a bit too, though is better in recent versions.
JDH
|