[yt-users] pixel resolution of plots

John Wise jwise at astro.princeton.edu
Mon Jan 3 07:22:21 PST 2011


Hi Wolfram,

You can change the resolution of the plots by specifying the figure size when making the plots in a plot collection.

pc = PlotCollection(pf, center=[0.5]*3)                                             
pc.add_projection('Temperature',0,'Density',fig_size=(15,12))                       
pc.save()                                                                           

This will create an image with a size of 15x12 inches.  On my system, the DPI is 100, so the resolution is 1500x1200.  I'm not sure where to change the DPI, but if you're only concerned with resolution, this will work.

Also you can use fixed resolution buffers, where you specify the resolution as the 3rd argument.  Then you can create a PNG with the built-in PNG writer (no colorbars) or use the plot collection framework.  Here's an example

proj = pf.h.proj(0, "Temperature", "Density")                                        
frb = FixedResolutionBuffer(proj, (0,1,0,1), (1600,1600))                            
iw.write_image(frb["Temperature"], "temp-projection.png")                            

where the image is 1600x1600 and plots a density-weighted temperature projection from (0,0) to (1,1).

Cheers,
John

On 3 Jan 2011, at 09:29, Wolfram Schmidt wrote:

> is it possible to change the pixel resolution of the plots produced by
> yt? For printed documents, the default resolution appears to be rather low.




More information about the yt-users mailing list