<div dir="ltr"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><br></div><div><br></div><div>===================================</div><div>Tim-Eric Rathjen</div><div>I. Physikalisches Institut</div><div>Universität zu Köln</div><div>Universitätsstr. 22</div><div>50937 Köln</div><div>Germany</div><div>email: <a href="mailto:rathjen@ph1.uni-koeln.de" target="_blank">rathjen@ph1.uni-koeln.de</a></div><div>phone: +49 (0) 221 470 8352</div></div></div></div></div></div>
<div dir="ltr">Hi,<br>
I'm trying to do some kind of a multiplot using yt and the .annotate_grids()-function provided with yt.<br>
<br>
My code looks like this:<br>
<br>
import yt<br>
import matplotlib.pyplot as plt<br>
from mpl_toolkits.axes_grid1 import AxesGrid<br>
<br>
fns = ['turb_vrms10_n3_pm__hdf5_plt_cnt_0200', 'turb_vrms10_n3_pm__hdf5_plt_cnt_0300']<br>
<br>
fig = plt.figure()<br>
<br>
# See <a href="http://matplotlib.org/mpl_toolkits/axes_grid/api/axes_grid_api.html">http://matplotlib.org/mpl_toolkits/axes_grid/api/axes_grid_api.html</a><br>
# These choices of keyword arguments produce a four panel plot with a single<br>
# shared narrow colorbar on the right hand side of the multipanel plot. Axes<br>
# labels are drawn for all plots since we're slicing along different directions<br>
# for each plot.<br>
grid = AxesGrid(fig, (0.075,0.075,0.85,0.85),<br>
                nrows_ncols = (2, 1),<br>
                axes_pad = 0.05,<br>
                label_mode = "L",<br>
                share_all = True,<br>
                cbar_location="right",<br>
                cbar_mode="single",<br>
                cbar_size="3%",<br>
                cbar_pad="0%")<br>
<br>
for i, fn in enumerate(fns):<br>
    # Load the data and create a single plot<br>
    ds = yt.load(fn) # load data<br>
<br>
    # Make a ProjectionPlot with a width of 34 comoving megaparsecs<br>
    p = yt.ProjectionPlot(ds, 'z', 'density').annotate_grids()<br>
    #p = yt.SlicePlot(ds, 'z', 'density').annotate_grids()<br>
<br>
    # Ensure the colorbar limits match for all plots<br>
    #p.set_zlim('density', 1e-4, 1e-2)<br>
    p.set_zlim('density', minVal, maxVal)<br>
<br>
    # This forces the ProjectionPlot to redraw itself on the AxesGrid axes.<br>
    plot = p.plots['density']<br>
    plot.figure = fig<br>
    plot.axes = grid[i].axes<br>
    plot.cax = grid.cbar_axes[i]<br>
   <br>
    # Finally, this actually redraws the plot.<br>
    p._setup_plots()<br>
<br>
plt.savefig('multiplot_1x2_time_series.png', bbox_inches='tight')<br>
<br>
And it works fine EXCEPT that it doesn't annotate the grid structure..<br>
Any ideas somebody?<br>
<br>
Thank you very much,<br>
Best regards,<br>
Tim-Eric<br></div></div>