I'm using the recently added PGF/Tikz support to save figures as .pgf
commands to include in a Latex document (I love this new feature!).

The final rendered figures look great after running through pdflatex, but
occasionally it's impractical to use pure vector drawing instructions.

For example, I'm currently working on a figure with 6 subplots, each
containing a scatter type plot with ~400k markers. The resulting .pgf file
is ~350MB.

Is it possible to rasterize the individual axes plots (to .png say) and
then generate a 'hybrid' .pgf output where things like axes ticks, labels,
etc are still vectorized, but the excessively dense scatter plot are
treated as imshow plots are and imported a raster images?

I've tried setting 'rasterized' = True  on both the axes and the plot
command, but no dice.

Sample code:

p = np.random.randn(400000,4)    # of course I have actual data, but this
should produce the same problem when saving
count = 0
for i in xrange(4):
    for j in xrange(i+1,4):
        count += 1
        ax = fig.add_subplot(2,3, count, rasterized=True)

        ax.plot(p[:,i], p[:,j], 'k.', markersize=0.25, rasterized=True)


Any advice or insight would be greatly appreciated.

Thanks
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to