Re: [Matplotlib-users] imshow without resampling

2009-11-30 Thread Geoffrey Ely
Hi, I found this old thread discussing the possibility of placing un- resampled images in PS, PDF and SVG. It was questioned weather there were any potential users for such a feature to justify the effort. If it makes a difference, here is one user who very much welcome it. I need to overlay p

Re: [Matplotlib-users] rasterizing a figure

2009-11-12 Thread Geoffrey Ely
On Nov 12, 2009, at 4:32 PM, Jae-Joon Lee wrote: > shape = fig.canvas.get_width_height()[::-1] + (4,) > > im = np.frombuffer(fig.canvas.buffer_rgba(0,0), > dtype=np.uint8).reshape(shape) > > Using buffer_rgba is more efficient than using tostring_rgb as no > memory is allocated. B

Re: [Matplotlib-users] rasterizing a figure

2009-11-12 Thread Geoffrey Ely
On Nov 12, 2009, at 2:01 PM, Christopher Barker wrote: > Geoffrey Ely wrote: >> Hi, What is the best way to rasterize a figure into a numpy array for >> further image processing? > > untested, but I suspect: >> image = >> numpy.frombuffer( fig.canvas.ren

[Matplotlib-users] rasterizing a figure

2009-11-12 Thread Geoffrey Ely
Hi, What is the best way to rasterize a figure into a numpy array for further image processing? The code I have below works, but I am wondering if there is a more convenient way. Thanks in advance, Geoff import pylab, numpy fig = pylab.figure() pylab.plot( [1, 2, 1] ) dpi = fig.get_dpi() size

Re: [Matplotlib-users] Unwanted lines between contourf() contour levels

2009-11-12 Thread Geoffrey Ely
On Nov 12, 2009, at 10:03 AM, Eric Firing wrote: > Geoffrey Ely wrote: >> Ryan, >> I have noticed the same issue with contourf. It seems to be a thin >> gap between neighboring polygons showing through. You can turn on >> a thin contour line of the same color to

Re: [Matplotlib-users] Unwanted lines between contourf() contour levels

2009-11-12 Thread Geoffrey Ely
Ryan, I have noticed the same issue with contourf. It seems to be a thin gap between neighboring polygons showing through. You can turn on a thin contour line of the same color to cover the gap: for c in pylab.contourf( x, y, z ).collections: c.set_linewidth( 0.1 ) Not ideal, but it wo