[yt-users] Image resolution

Matthew Turk matthewturk at gmail.com
Fri Dec 3 15:21:55 PST 2010


Hi Dave,

On Fri, Dec 3, 2010 at 12:24 PM, David Collins
<dcollins at physics.ucsd.edu> wrote:
> Thanks.  I think the second option is what I'm looking for, and 'dig
> through MPL' is what I was afraid you were going to say.
>
> Basically I want a plot like what comes out of pc.add_projection();
> pc.save(), color bar and axes labels and whatnot, but with the
> projection at a given resolution.  Some combination of fig_size and
> dpi will do it, provided I know how things scale, which points, as you
> mentioned, to the MPL docs.

Another option would be to save the image buffer directly, save a
colorbar directly, and then use the montage command from ImageMagick
to combine the two.  This would also allow for fine-grained control
over the image size.

-Matt

>
> d.
>
> On Fri, Dec 3, 2010 at 11:23 AM, Matthew Turk <matthewturk at gmail.com> wrote:
>> Hi Dave,
>>
>> On Fri, Dec 3, 2010 at 10:44 AM, david collins <antpuncher at gmail.com> wrote:
>>> Hi--
>>>
>>> I've been asked to produce some figures with a specific resolution in
>>> my projection plots.
>>>
>>> I know that the fig_size will change the size of the entire image, but
>>> I don't know how the borders and colorbar sizes scale.  Is there an
>>> obvious way to get this information, or a way to directly control the
>>> size of the projection portion of the figure itself?
>>
>> It's not entirely clear to me what you're asking, and depending on the
>> output image format, the answer will vary.  I've selected a couple
>> options, but I'm not sure that they cover what you are looking for.
>>
>> If you are looking for a PNG image made from either a slice or a
>> projection, wherein a floating-point 2D buffer is scaled to some
>> min/max and then output completely filling the entire image, you can
>> and should use the FixedResolutionBuffer and then the write_image
>> command.  Both are provided in yt.mods in the current development tip.
>>  The DPI used in write_image is set to be 100, but as you know this is
>> not always relevant for PNG files.
>>
>> If you are looking for a PNG image with a colorbar, then you must use
>> matplotlib, and you will have to supply either axes= and figure=
>> arguments to the creation of a Plot object, or you can use the
>> FixedResolutionBuffer and manually create your entire image.  Figures
>> can have set DPIs as well as sizes, but as for the border and whatnot,
>> you will have to read the matplotlib documentation for more help with
>> that.
>>
>> If you are looking for an EPS image without a colorbar, I would
>> suggest you create a PNG and then convert it by hand.
>>
>> If you are looking for an EPS image with a colorbar, you will have to
>> follow the same steps for the plot collection.  Alternately, John Wise
>> may have a solution to this using the PyX library that he has created
>> an excellent wrapper for.
>>
>> Finally, if your question is less about the number of pixels in an
>> image plane as opposed to the final *size* of the image including
>> everything, you should investigate the judicious modification of the
>> DPI in a given figure.
>>
>> Good luck,
>>
>> Matt
>>
>>>
>>> Thanks,
>>> d.
>>>
>>> --
>>> Sent from my Stone Tablet and carried by my Pterodactyl.
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>
>
>
> --
> Sent from my Stone Tablet and carried by my Pterodactyl.
> _______________________________________________
> 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