I just thought I'd mention a little more detail about what I've found with respect to writing grey/colorscales to vector graphics formats. The bottom line is that to plot a grayscale or colorscale in a vector graphics format without resampling, it seems at the moment that pcolorfast works best, in SVG format (not PS).
Attached is a script to try out different combinations of methods, formats, and canvas sizes. In all cases I am plotting a 10x10 numpy array. The file sizes I obtain are:
$ du -sh example*
584K example1.ps (imshow and 4x4 canvas)
2.2M example2.ps (imshow and 8x8 canvas)
84K example3.svg (imshow and 4x4 canvas)
204K example4.svg (imshow and 8x8 canvas)
600K example5.ps (pcolorfast and 4x4 canvas)
2.3M example6.ps (pcolorfast and 8x8 canvas)
16K example7.svg (pcolorfast and 4x4 canvas)
20K example8.svg (pcolorfast and 8x8 canvas)
As you can see, example7.svg and example8.svg are by far the smallest files, and their sizes aren't that different, which is the way things should be as changing the canvas size shouldn't be changing much since it is a vector graphics format. It's interesting to see that imshow and pcolorfast produce different results for SVG (both smaller than the PS results)
Interestingly, pcolorfast shows no improvement compared to imshow for the PS files, and in addition, the 4x4 images are 4 times smaller than the 8x8 images, suggesting that in all cases, the colorscale has been rasterized to a finer resolution.
It might be worth seeing how the SVG driver implements this and apply the same technique to the PS driver. The fact that the SVG driver can do this suggests that the matplotlib API should be able to handle this and so all that is needed is to work on the PS driver?
As a temporary solution, it is possible to produce SVG files and convert these to PS, but this is not an ideal solution.
Let me know if you have any questions about this,
resampling.py (940 Bytes)