I've looked into this some more, and while pcolor draws pixels  
inefficiently as polygons, pcolorfast does appear to be writing the  
data as a bitmap into the eps file, so this is closer to what I need.

However, while this works great with the SVG driver, it seems that  
pcolorfast still produces quite large files with the PS driver. For  
example,

import matplotlib
matplotlib.use('Agg')
from matplotlib.pyplot import *
import numpy as np

image = np.random.random((100,100))

fig = figure(figsize=(4,4))
ax = fig.add_subplot(111)
ax.pcolorfast(image)
fig.savefig('plot.eps')

fig = figure(figsize=(4,4))
ax = fig.add_subplot(111)
ax.pcolorfast(image)
fig.savefig('plot.svg')

produces a 600k ps file and a 60k svg file. In fact, the PS file size  
remains the same if I change the size of the array.

So pcolorfast does appear to be the solution, but the output is not  
properly handled for PS files. Is this something that could be fixed  
in future?

Thanks,

Thomas

On Mar 31, 2009, at 4:32 PM, John Hunter wrote:

> On Tue, Mar 31, 2009 at 2:56 PM, Thomas Robitaille
> <thomas.robitai...@gmail.com> wrote:
>> Hello,
>>
>> I am using matplotlib to create postscript and SVG files. I am
>> currently using imshow to show the contents of an array, but this
>> means that when saving vector graphics files, matplotlib resamples  
>> the
>> image/array onto a finer grid. What I would like, is for code such as
>> this:
>
>
> I believe pcolor will be closer to what you are looking for.7
>
> JDH


------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to