I have observed that the amount of time to draw a figure with a plot
depends heavily on the number of tick marks on the axes. This appears
to be a major driver of perceived refresh performance on interactive
graphics in PySide (for example). Somewhat tangentially this makes
log axes appear to perform slowly, but I think that is merely a
side-effect of the fact that log axes come with minor tick marks by
default. I'm working with built-from-source matplotlib as of Apr 17,
2014; I think the observations here apply to any recent matplotlib.
I've published a full illustration at
https://gist.github.com/jbmohler/7c5c8cca39826ea8ede7 . This small
PySide application lets you enter the number of points in a scatter
plot and the number of minor tick marks. You can see for yourself
that increasing the number of points in the scatter plot has little
impact on performance, but increasing the number of tick marks has a
noticeable effect with only moderate increase.
Why does this matter if you have a sane number of tick marks? It
points to tick marks being simply very expensive -- on my 2 year old
quad core, entirely removing tick marks results in 117 frames per
second, but with 7 (major) tick marks on x & y that drops to 38 frames
per second. I think 100 tick marks falls with-in "sane" (in some
cases) and a graph with 100 tick marks has decidedly more lag in a gui
than 10 tick marks. As mentioned above, log axes are particularly
likely place to have lots of tick marks.
How can I fix this? I'm not sure, but I think there are reasonable
special cases that could be highly optimized. The problem seems to me
to be that each tick mark is a Line2D artist and that has a marker
type (in fact, I think there is no "line" shown, the tick mark is the
single marker of the Line2D). In the case of uniform sized tick
marks, I believe the tick marks for an axis could be all in one Line2D
with each tick mark being a marker in the single Line2D. This is a
huge reduction of artists which seems likely to yield a speed up in
quite few places.
I'd love to hear your thoughts and/or fix suggestions on this topic.