[yt-users] Making a Multiplot using Ramses data

k.grisdale at surrey.ac.uk k.grisdale at surrey.ac.uk
Tue Nov 12 00:46:31 PST 2013


Hi Matt.

The Script you sent me has been of great help! I have now managed to get yt to plot projections for my data.

However I am still having small trouble. Firstly script only plots the 1 quarter of each projection(I can change which quarter), [Graph below] and secondly I would like to set the colorbar to be linear for my data. How can I go about that?

Thanks

Kearn

[cid:2ABCAB42-4A79-4A32-83DD-88FE8CEBB9E9 at surrey.ac.uk]
On 11 Nov 2013, at 22:39, Matthew Turk <matthewturk at gmail.com<mailto:matthewturk at gmail.com>> wrote:

Hi Kearn,

Oops, I guess my reply was less than helpful!  Sorry about that --
been one of those days.

On Mon, Nov 11, 2013 at 3:30 PM,  <k.grisdale at surrey.ac.uk<mailto:k.grisdale at surrey.ac.uk>> wrote:
Hi Matt,

Thanks for the reply. The code that I used below is my attempt at adapting
the script on the yt pages explaining how to use Multi-Plot Slice and
Projections. As I couldn’t figure out how make multi-plots of yt Projections
I thought I’d try the adapting route. Which means there bits there I don’t
get but have included as I thought they where needed for the multi plot.


I've spent a bit of time looking at this and I've been able to make a
multi plot that I think matches what you're looking for.  I've put the
script here, and I've also tried to note where there might be issues
with it that could be important when you adapt it to your data.

http://paste.yt-project.org/show/4047/

Let me know if that helps out, or if I can help in any other way.

-Matt

Thanks again

Kearn



On 11 Nov 2013, at 20:13, Matthew Turk <matthewturk at gmail.com> wrote:

Hi Kearn,


On Mon, Nov 11, 2013 at 10:18 AM, <k.grisdale at surrey.ac.uk> wrote:

Hi everyone

I am trying to make a multi plot using data from Ramses. I have outputs
from Ramses at 6 different times and I want to make projections at each time
and place than in a multi plot to show evolution of the system. However when
the code that I have written gives the results below.


<Screen Shot 2013-11-11 at 15.12.13.png>


Can anyone offer any suggestions as to wear my code is going wrong?

Thanks

Kearn

The code I’m using ( the for dax lines have been commented out because
every time they are included I get the error at the bottom)

from yt.mods import * # set up our namespace
import matplotlib.colorbar as cb
from matplotlib.colors import LogNorm

p1 = load("output_00001/info_00001.txt")
p2 = load("output_00002/info_00002.txt")
p3 = load("output_00003/info_00003.txt")
p4 = load("output_00004/info_00004.txt")
p5 = load("output_00005/info_00005.txt")
p6 = load("output_00006/info_00006.txt")

cen = [0,0,0]
orient = 'vertical'

fig, axes, colorbars = get_multi_plot(3, 2, colorbar=orient, bw = 4)
proj1 = p1.h.proj(2, "Density", center=cen)
proj2 = p2.h.proj(2, "Density", center=cen)
proj3 = p3.h.proj(2, "Density", center=cen)
proj4 = p4.h.proj(2, "Density", center=cen)
proj5 = p5.h.proj(2, "Density", center=cen)
proj6 = p6.h.proj(2, "Density", center=cen)

proj1_frb = proj1.to_frb((0.7,"cm"),512)
proj2_frb = proj2.to_frb((0.7,"cm"),512)
proj3_frb = proj3.to_frb((0.7,"cm"),512)
proj4_frb = proj4.to_frb((0.7,"cm"),512)
proj5_frb = proj5.to_frb((0.7,"cm"),512)
proj6_frb = proj6.to_frb((0.7,"cm"),512)

dens_axes = [axes[0][0], axes[1][0]]

#for dax in zip(dens_axes) :


I'm not sure what you're doing here -- this will yield:

[(axes[0][0],), (axes[1][0],)]

So you'll be getting back a tuple of length one inside the loop.  You should
be able to do dax[0]?  But I'm not sure you need to zip in the first place,
either.

-Matt



#    dax.xaxis.set_visible(False)
#    dax.yaxis.set_visible(False)

plots = [dens_axes[0].imshow(proj1_frb["Density"],origin ='lower'),
        dens_axes[0].imshow(proj2_frb["Density"],origin ='lower'),
        dens_axes[0].imshow(proj3_frb["Density"],origin ='lower'),
        dens_axes[0].imshow(proj4_frb["Density"],origin ='lower'),
        dens_axes[0].imshow(proj5_frb["Density"],origin ='lower'),
        dens_axes[0].imshow(proj6_frb["Density"],origin ='lower')]

plots[0].set_clim((0.0,0.34))
plots[0].set_cmap("YlOrRd")
plots[1].set_clim((0.0,0.345))
plots[1].set_cmap("YlOrRd")
plots[2].set_clim((0.0,0.34))
plots[2].set_cmap("YlOrRd")
plots[3].set_clim((0.0,0.34))
plots[3].set_cmap("YlOrRd")
plots[4].set_clim((0.0,0.34))
plots[4].set_cmap("YlOrRd")
plots[5].set_clim((0.0,0.34))
plots[5].set_cmap("YlOrRd")

fig.savefig("test”)


error:

Traceback (most recent call last):
 File "plotterm2.py", line 34, in <module>
   dax.xaxis.set_visible(False)
AttributeError: 'tuple' object has no attribute 'xaxis'

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


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


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

_______________________________________________
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/20131112/6bbd17bc/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2013-11-12 at 08.46.03.png
Type: image/png
Size: 22992 bytes
Desc: Screen Shot 2013-11-12 at 08.46.03.png
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20131112/6bbd17bc/attachment.png>


More information about the yt-users mailing list