[yt-users] overplot grid sturcutre (with .annotate_grids()) while using Axesgrid

Nathan Goldbaum nathan12343 at gmail.com
Fri Oct 16 14:52:42 PDT 2015


Hi Tim,

Sorry for taking a couple of days to respond. I just had a free moment and
it looks like I'm able to get this working with annotate_grids on yt 3.2.1
using the following script:

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

Here's the image I get:

http://i.imgur.com/OYFz4Kv.png

In your e-mail you don't mention which yt version you're on. If you're not
on yt-3.2.1 I'd urge you to update since a large number of bugfixes are in
that version (including one that might be related to this exact issue:
https://bitbucket.org/yt_analysis/yt/issues/1064/cannot-access-projection_plotplots-string
).

-Nathan


On Wed, Oct 14, 2015 at 10:20 AM, Dominik Derigs <derigs at ph1.uni-koeln.de>
wrote:

> for verts in slc.ds.grid_lines:
> grid_collection = PolyCollection(verts, facecolors="none",
> edgecolors=(1.0,1.0,1.0,0.2),linewidth=0.1)
> grid[gridid].axes.add_collection(grid_collection)
>
> 2015-10-14 15:50 GMT+02:00 Tim-Eric Rathjen <rathjen at ph1.uni-koeln.de>:
>
>>
>>
>>
>> ===================================
>> Tim-Eric Rathjen
>> I. Physikalisches Institut
>> Universität zu Köln
>> Universitätsstr. 22
>> 50937 Köln
>> Germany
>> email: rathjen at ph1.uni-koeln.de
>> phone: +49 (0) 221 470 8352
>> Hi,
>> I'm trying to do some kind of a multiplot using yt and the
>> .annotate_grids()-function provided with yt.
>>
>> My code looks like this:
>>
>> import yt
>> import matplotlib.pyplot as plt
>> from mpl_toolkits.axes_grid1 import AxesGrid
>>
>> fns = ['turb_vrms10_n3_pm__hdf5_plt_cnt_0200',
>> 'turb_vrms10_n3_pm__hdf5_plt_cnt_0300']
>>
>> fig = plt.figure()
>>
>> # See http://matplotlib.org/mpl_toolkits/axes_grid/api/axes_grid_api.html
>> # These choices of keyword arguments produce a four panel plot with a
>> single
>> # shared narrow colorbar on the right hand side of the multipanel plot.
>> Axes
>> # labels are drawn for all plots since we're slicing along different
>> directions
>> # for each plot.
>> grid = AxesGrid(fig, (0.075,0.075,0.85,0.85),
>>                 nrows_ncols = (2, 1),
>>                 axes_pad = 0.05,
>>                 label_mode = "L",
>>                 share_all = True,
>>                 cbar_location="right",
>>                 cbar_mode="single",
>>                 cbar_size="3%",
>>                 cbar_pad="0%")
>>
>> for i, fn in enumerate(fns):
>>     # Load the data and create a single plot
>>     ds = yt.load(fn) # load data
>>
>>     # Make a ProjectionPlot with a width of 34 comoving megaparsecs
>>     p = yt.ProjectionPlot(ds, 'z', 'density').annotate_grids()
>>     #p = yt.SlicePlot(ds, 'z', 'density').annotate_grids()
>>
>>     # Ensure the colorbar limits match for all plots
>>     #p.set_zlim('density', 1e-4, 1e-2)
>>     p.set_zlim('density', minVal, maxVal)
>>
>>     # This forces the ProjectionPlot to redraw itself on the AxesGrid
>> axes.
>>     plot = p.plots['density']
>>     plot.figure = fig
>>     plot.axes = grid[i].axes
>>     plot.cax = grid.cbar_axes[i]
>>
>>     # Finally, this actually redraws the plot.
>>     p._setup_plots()
>>
>> plt.savefig('multiplot_1x2_time_series.png', bbox_inches='tight')
>>
>> And it works fine EXCEPT that it doesn't annotate the grid structure..
>> Any ideas somebody?
>>
>> Thank you very much,
>> Best regards,
>> Tim-Eric
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>
>
> --
> Dominik Derigs
> I. Physikalisches Institut
> Universität zu Köln
> Zülpicher Straße 77
> 50937 Köln
> GERMANY
>
> Tel. (+49|0) 221 470-8352
> Fax. (+49|0) 221 470-5162
>
> Diese Email ist vertraulich und nur für den angegebenen Empfänger
> bestimmt. Zugang, Freigabe, die Kopie, die Verteilung oder Weiterleitung
> durch jemand anderen außer dem Empfänger selbst ist verboten und kann eine
> kriminelle Handlung sein. Bitte löschen Sie die Email, wenn Sie sie durch
> einen Fehler erhalten haben und informieren Sie den Absender.
>
> This email and any files transmitted with it may contain confidential
> and/or privileged material and is intended only for the person or entity to
> which it is addressed. Any review, retransmission, dissemination or other
> use of, or taking of any action in reliance upon, this information by
> persons or entities other than the intended recipient is prohibited. If you
> have received this email in error, please notify the sender immediately and
> delete this material from all known records.
>
> _______________________________________________
> 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/20151016/b02958fd/attachment.html>


More information about the yt-users mailing list