[yt-users] text onto 3D image

Michael Zingale michael.zingale at stonybrook.edu
Fri Jul 18 07:46:44 PDT 2014


Hi Stephanie, I added an optional argument to save_annotated that allows me
to use an existing figure to render to.  I do something like this:

    cam = vr.Camera(c, L, W, N, transfer_function=tf, pf=pf,
                    no_ghost=False, #data_source=reg,
                    fields = [field], log_fields = [use_log])

   im = cam.snapshot()

    cam.draw_coordinate_vectors(im)
    cam.show_tf()
    nim = cam.draw_domain(im)

    f = pylab.figure()

    pylab.text(0.2, 0.85, "{:.3g} s".format(float(pf.current_time.d)),
               transform=f.transFigure, color="white")

    cam._render_figure = f

    cam.save_annotated("xrb_vol_{}.png".format(fname), nim, dpi=145,
clear_fig=False)


I plan to add an example to the docs about this once I am done travelling.





On Fri, Jul 18, 2014 at 10:41 AM, Stephanie Tonnesen <stonnes at gmail.com>
wrote:

> Hi yt-ers,
>
> I am making individual snapshots of a simulation, using:
>
> >from yt.visualization.volume_rendering.api import ColorTransferFunction
>
> >tf = ColorTransferFunction((-29,-24))
> >tf.add_layers(8,w=0.05,colormap="Hue Sat Value 2")
> >tf.sample_colormap(-26.5,w=0.02,colormap="Hue Sat Value 2")
> >cam = pf.h.camera([0.0,0.0,1.8],[0.0,-1.0,-0.2],4.4,1024,tf)
> >im = cam.snapshot('rpsdip_'+sys.argv[1]+'_volumeall.png')
>
> I would like to add a timestamp to the frame (and possibly my name while
> I'm at it!).  I know how to add text to a plot, but am not sure how to do
> it here.  Any help is most appreciated!
>
> Thanks,
>
> Stephanie
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>


-- 
Michael Zingale
Associate Professor

Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY
11794-3800
*phone*:  631-632-8225
*e-mail*: Michael.Zingale at stonybrook.edu
*web*: http://www.astro.sunysb.edu/mzingale
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20140718/c5eb1719/attachment.html>


More information about the yt-users mailing list