[yt-users] plotting questions

Agarwal, Shankar sagarwal at ku.edu
Tue Nov 24 08:57:12 PST 2009


Thanks Matt. 
Also, I am not able to loop over method 1. I am using the stupid way as shown below.
And method 2 is not showing the grids.


from yt.mods import *
# method1
p = plots.get_slice("RedshiftOutput0002", "Density", 0)
p.modify["grids"]()
p.modify["contour"]("Density")
p.save_image("a")

p = plots.get_slice("RedshiftOutput0002", "Density", 1)
p.modify["grids"]()
p.modify["contour"]("Density")
p.save_image("b")

p = plots.get_slice("RedshiftOutput0002", "Density", 2)
p.modify["grids"]()
p.modify["contour"]("Density")
p.save_image("c")


# method2
pf = load("RedshiftOutput0002")
pc = PlotCollection(pf)
for ax in range(3): 
    pc.add_slice("Density", ax).modify["grids"]()
    pc.add_slice("Density", ax).modify["contour"]("Density")
pc.save("plot2")





shankar


-----Original Message-----
From: yt-users-bounces at lists.spacepope.org on behalf of Matthew Turk
Sent: Tue 11/24/2009 10:44 AM
To: Discussion of the yt analysis package
Subject: Re: [yt-users] plotting questions
 
Hi Shankar,

> My simulation box is 200 Mpc/h. I wanted to know what are the default span (length scales) for the 2 methods ?
> For plot 1, how can I control the spacing of contours ? And where is plot 1 centered at ?

It took me a moment to track down what's happening.  The default
length scale is "unitary" -- which is the entire domain.  However, the
difference between the two plots is because plot collection-mediated
plots default to being periodic, and this will reset .  I have changed
it so that the behavior between the two plot generation mechanisms is
identical, in r1543.  However, if you do not wish to upgrade, you can
feed the argument "periodic=True" to the get_slice_plot call.

> For plot 2, it is centered at the most dense point in the box. But how can I add density contours ? Also, how to control the spacing ?

You can add density contours the same way you did for the first
mechanism -- through the modify["contours"] call.  :)  You can control
the spacing a couple ways, as mentioned in the manual:

http://yt.enzotools.org/doc/advanced/callbacks.html#available-callbacks

through the ncont, clim, and take_log functions.  If you look at the
source code, you can see that ncont is fed directly to the matplotlib
contour command -- so you can get greater control by feeding it, for
instance, a list of density contours.  Note that the mechanism for
log-spaced contours is to log the data, not request log-spaced
contours, so you will have to keep that in mind if you choose to
request specific contour levels.

-Matt
_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 4038 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20091124/00039e89/attachment.bin>


More information about the yt-users mailing list