[yt-users] plotting questions

Agarwal, Shankar sagarwal at ku.edu
Tue Nov 24 10:30:15 PST 2009


Hi Matt,

So I tried to plot the velocity vectors. But they cover only 1/4th of the Box.
And what can I do about "unitary" ?

pf = load("RedshiftOutput0002")
pc = PlotCollection(pf)
for ax in range(3):
   p = pc.add_slice("Density", ax)
   p.modify["grids"]()
   p.modify["contour"]("Density",ncont=4,take_log=True,clim=(1e-28,1e-30))
   p.modify["velocity"](factor=16)
   p.modify["coord_axes"](unit="Mpc")
pc.save("plot2")

shankar




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

> Also, I am not able to loop over method 1. I am using the stupid way as shown below.

Sure you can loop!  :)  Here's a way to do it:

for ax in range(3):
    p = plots.get_slice("RedshiftOutput0002", "Density", ax)
    p.modify["grids"]()
    p.modify["contours"]("Density")
    p.save_image("something_%s" % ax)

That last line will make sure that your images have different names --
and that's actually what's going wrong with the second loop that you
had below.

(I'd like to note that having similar plots on different axes is why
the Plot Collection is around -- so I'd suggest you stick to that, as
it will make changing widths and whatnot easier.)

> And method 2 is not showing the grids.
> for ax in range(3):
>    pc.add_slice("Density", ax).modify["grids"]()
>    pc.add_slice("Density", ax).modify["contour"]("Density")
> pc.save("plot2")

Ah!  What's going on here is that the plot collection, at the end of
the loop, has *six* plots:

slice on x with grids
slice on x with contours
slice on y with grids
slice on y with contours
slice on z with grids
slice on z with contours

BUT, the callbacks aren't taken into account when creating image file
names.  So it just overwirtes the first slice with the second, the
third with the fourth, and the fifth with the sixth.  What you
probably want to do is:

for ax in range(3):
   p = pc.add_slice("Density", ax)
   p.modify["grids"]()
   p.modify["contour"]("Density")
pc.save("plot2")

This way you're modifying the same plot object with both grids and contours.

Best of luck,

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: winmail.dat
Type: application/ms-tnef
Size: 420079 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20091124/c60fc547/attachment-0001.bin>


More information about the yt-users mailing list