[yt-users] Colorbar and labels on volume rendered images

Britton Smith brittonsmith at gmail.com
Wed Jan 5 08:29:51 PST 2011


It is possible to attach a colormap to a volume render image.  I can't quite
remember how to do that.  If someone else could chime in on that, that would
be great.
If you already have the colorbar image you want, you can concatenate two
image arrays easily and then write out the new image, provided the arrays
are the same size in one direction.  With pylab, you can do something like
this:
from matplotlib import pylab
import numpy as na
from yt.visualization.image_writer import write_bitmap
image1 = pylab.imread(file1)
image2 = pylab.imread(file2)
new_image = na.concatenate([image1, image2], axis=1)
write_bitmap(new_image, output_file)

I believe the image_writer now supports adding text as well, so that should
take care of the labels.

Britton

On Wed, Jan 5, 2011 at 10:46 AM, Elizabeth Harper-Clark <
h-clark at astro.utoronto.ca> wrote:

> Good morning everyone,
>
> I was wondering how to add colorbars and text labels (e.g. with the time)
> to images produced through volume rendering. I am unsure of how to adapt all
> the usual techniques I know for projections etc. gievn the different
> technique for drawing the images. I am using a constant colorbar so if
> anyone can suggest a post-processing way of adding to created images that
> would work too!
>
> I am using the following to create my volume rendered images:
>     for i, snapshot in enumerate(cam.rotation(2.*na.pi, n_angles)):
>         print "     drawing:  dump =", numb, "angle =",  i, "shot=",shott
>         if cam._mpi_get_rank() == 0:
>             write_bitmap(snapshot, frame_template % (sys.argv[-1],shott))
>             pl.draw()
>             shott = shott+1
>
> Many thanks,
>
> Libby
>
> --
> Elizabeth Harper-Clark MA MSci
> PhD Candidate, Canadian Institute for Theoretical Astrophysics, UofT
> Sciences and Engineering Coordinator, Teaching Assistants' Training
> Program, UofT
>
> www.astro.utoronto.ca/~h-clark <http://www.astro.utoronto.ca/%7Eh-clark>
> h-clark at cita.utoronto.ca
> Astronomy office phone: +1-416-978-5759
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20110105/0dbdc552/attachment.html>


More information about the yt-users mailing list