[yt-users] multi projection plots with title and annotations

Guido granda muñoz guidogranda at gmail.com
Sat Sep 12 15:33:44 PDT 2015


Hello there,

I'm trying to do a multipanel plot of projected density with titles in each
axis and annotations but I couldn't figure out how to do it, could you
please help me.

I'm using AxesGrid as in your example(
http://yt-project.org/doc/cookbook/complex_plots.html#multipanel-with-axes-labels)
however
something is wrong. I'm sending my output image as a attached file.

My code is the following:




import yt
import matplotlib.pyplot as plt
import sys
import numpy as np
from mpl_toolkits.axes_grid1 import AxesGrid
import matplotlib.colorbar as cb
from matplotlib.colors import LogNorm

data=[]
data.append(sys.argv[1])
data.append(sys.argv[2])
data.append(sys.argv[3])
data.append(sys.argv[4])

pf1=yt.load(data[0])
pf2=yt.load(data[1])
pf3=yt.load(data[2])
pf4=yt.load(data[3])

pfs=[]
pfs.append(pf1)
pfs.append(pf2)
pfs.append(pf3)
pfs.append(pf4)


fig=plt.figure()
grid = AxesGrid(fig, (0.075,0.075,0.85,0.85),nrows_ncols = (2, 2),axes_pad
= 1.0,label_mode = "all",share_all =
True,cbar_location="right",cbar_mode="single",cbar_size="5%",cbar_pad="5%",cbar_set_cax=True)


axe=['y','y','y','y']
field=['density','density','density','density']
colors=[]
title=['100 Mpc/h box size', '75 Mpc/h box size','100 Mpc/h box size','50
Mpc/h box size']

for i in range(len(data)):
    p
=yt.ProjectionPlot(pfs[i],axe[i],field[i],center='c',width=(25,'Mpc/h'))
        p.set_zlim('density',4.4601764879407653e-5,5.0e-2)
        p.annotate_timestamp(corner='upper_left',
redshift=True,draw_inset_box=True)
        p.annotate_title(title[i])
        plot=p.plots[field]
        plot.figure=fig
        plot.axes=grid[i].axes
        plot.cax=grid.cbar_axes[i]
        p._setup_plots()


fig.savefig('plot1_f.png',pdi=300)




Kind regards,
-- 
Guido
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150912/485d62ab/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot1_f.png
Type: image/png
Size: 265729 bytes
Desc: not available
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150912/485d62ab/attachment.png>


More information about the yt-users mailing list