<div dir="ltr">Hi Hao,<div><br></div><div>This was due to a bug in the _switch_pf function.  I've issued a pull request to fix it here: <a href="https://bitbucket.org/yt_analysis/yt/pull-request/1132/fixing-an-issue-with-plots-created-via/diff">https://bitbucket.org/yt_analysis/yt/pull-request/1132/fixing-an-issue-with-plots-created-via/diff</a></div>

<div><br></div><div>-Nathan</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 5, 2014 at 6:57 AM, Hao Wang <span dir="ltr"><<a href="mailto:hwang.phy@gmail.com" target="_blank">hwang.phy@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi all,<br><br>I have been trying to make a movie out of annotated projection plots but encountered the following problem:<br>

</div><div><br></div>------------error message-----------------------------<br>

<div>  File "...../yt/src/yt-hg/yt/visualization/plot_modifications.py", line 1157, in _get_region<br>    LE[zax] = data.center[zax] - self.width*0.5<br>

TypeError: 'NoneType' object has no attribute '__getitem__'<br><div>--------------------------------------------------------------</div><div><br></div><div>I pasted the script (copied from the yt Cookbook) I used below. It worked fine without the "prj.annotate_particles(1.0)" line. The annotation itself works too -- the figure looks good in the IPython notebook.</div>



<div><br></div><div>======Script (anim.py)==================================</div><div>import matplotlib.animation as anim<br>

from matplotlib.backends.backend_agg import FigureCanvasAgg<br>from yt.mods import *<br><br>prj = ProjectionPlot(load('DD0000/DD0000.hierarchy'), "z", 'Density')<br>prj.annotate_particles(1.0) # adding this line causes error<br>





<br>fig = prj.plots['Density'].figure<br>fig.canvas = FigureCanvasAgg(fig)<br><br>def animate(i):<br>    filename = './DD%04i/' % i + 'DD%04i' % i + '.hierarchy'<br>    pf = load(filename)<br>



    prj._switch_pf(pf)<br>

<br>density_ani = anim.FuncAnimation(fig, animate, frames=100, interval=100,<br>        blit=False)<br><br>density_ani.save('density_animation.mp4')<br clear="all">====================<br><br></div><div>Could anyone point out the problem? <br>



</div><div>

<br>Thanks in advance, <br><div>Hao<br></div>
</div></div></div>
<br>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>