nertskull <[email protected]> writes:
> The problem, is the pdf is unbearably slow when plotting as a scatter plot
> or as a line with markers.
>
> If I make a regular line plot, with no markers, just a single line, it is
> plotted and the pdf is fine. But then it connects my points which I don't
> want.
Others have commented on the volume of data, but that paragraph makes
me curious: are you saying that the results are acceptable if you do
something like
plot(x, y, '-')
but not if you do
plot(x, y, 'o') or plot(x, y, '-o')?
The amount of data in the pdf file should be within a constant factor in
all cases, but the '-' case there are only moveto and lineto commands,
while the two other cases render markers as something called an XObject,
which is repeated a lot of times on the page. I wonder if the overhead
from using an XObject is making the rendering application slow.
Does it help at all to use a simpler marker, e.g. plot(x, y, ',')? One
change you could try if you're feeling adventurous is the following
function in lib/matplotlib/backends/backend_pdf.py:
def draw_markers(self, gc, marker_path, marker_trans, path, trans,
rgbFace=None):
# For simple paths or small numbers of markers, don't bother
# making an XObject
if len(path) * len(marker_path) <= 10:
RendererBase.draw_markers(self, gc, marker_path, marker_trans,
path, trans, rgbFace)
return
# ...
The comment is not quite right: only if the path is short *and* the
number of markers is small does the XObject code get skipped. You could
just change the if statemt to "if True:" and rerun your code (possibly
with the ',' marker style). If that helps, it's evidence that we need to
revisit the condition for using XObjects for markers.
--
Jouni K. Seppänen
http://www.iki.fi/jks
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos. Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users