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

Nathan Goldbaum nathan12343 at gmail.com
Sat Sep 12 16:46:25 PDT 2015


Just in case you haven't updated in a while, I would do so since there was
a fix included in yt 3.2.1 that might solve your problem.

https://bitbucket.org/yt_analysis/yt/pull-requests/1698/ensure-the-frb-is-valid-before-executing/diff

If you're already on yt 3.2.1 I'll take a closer look at this soon.

Nathan

On Saturday, September 12, 2015, Guido granda muñoz <guidogranda at gmail.com>
wrote:

> 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/737c1d25/attachment.html>


More information about the yt-users mailing list