[yt-users] Image resolution

Matthew Turk matthewturk at gmail.com
Fri Dec 3 11:23:28 PST 2010


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
>



More information about the yt-users mailing list