[yt-users] yt-users Digest, Vol 35, Issue 2

Matthew Turk matthewturk at gmail.com
Tue Jan 4 08:36:40 PST 2011


Hi Wolfram,

Looking over the code, I think you might be able to mock this up using
the bw and dpi arguments to get_multiplot.  The creation of the figure
in the multiplot code works like this:

    hf, wf = 1.0/ny, 1.0/nx
    fudge_x = fudge_y = 1.0
    if colorbar is None:
        fudge_x = fudge_y = 1.0
    elif colorbar.lower() == 'vertical':
        fudge_x = nx/(0.25+nx)
        fudge_y = 1.0
    elif colorbar.lower() == 'horizontal':
        fudge_x = 1.0
        fudge_y = ny/(0.40+ny)
    fig = figure.Figure((bw*nx/fudge_x, bw*ny/fudge_y), dpi=dpi)

So, bw will be the "base width/height" of a single axes object inside
the figure (I suppose it should be 'base size' but I'll refrain from
abbreviating that for now) in inches and dpi will be the dots per
inch.  That should work out, the same way John suggested.

I've updated the docstring, which was missing this information, to
reflect this.  Let me know if that helps!

-Matt

On Tue, Jan 4, 2011 at 4:08 AM, Wolfram Schmidt
<schmidt at astro.physik.uni-goettingen.de> wrote:
> On 01/03/2011 07:33 PM, yt-users-request at lists.spacepope.org wrote:
> Hi John,
>
> thanks for your suggestions! Unfortunately, the first option doesn't
> seem to work for multi plots, and I am not sure how option 2 can be
> carried over to multi plots.
>
> Cheers,
> Wolfram
>
>> ------------------------------
>>
>> Message: 2
>> Date: Mon, 3 Jan 2011 10:22:21 -0500
>> From: John Wise <jwise at astro.princeton.edu>
>> To: Discussion of the yt analysis package
>>       <yt-users at lists.spacepope.org>
>> Subject: Re: [yt-users] pixel resolution of plots
>> Message-ID: <499D34F2-6DD9-4D44-B89E-504CE732AA2A at astro.princeton.edu>
>> Content-Type: text/plain; charset=us-ascii
>>
>> 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.
>>
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>> End of yt-users Digest, Vol 35, Issue 2
>> ***************************************
>>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list