<html><head></head><body bgcolor="#FFFFFF"><div>Hi Sam,</div><div><br></div><div>Thank you so much! Now it works:-)</div><div><br></div><div>Have a nice day!</div><div><br></div><div>Pengfei <br><br>在 2012-7-17,8:12,Sam Skillman <<a href="mailto:samskillman@gmail.com">samskillman@gmail.com</a>> 写道:<br><br></div><div></div><blockquote type="cite"><div>Hi Penfei,<div><br></div><div>It seems there might be a bug in the title callback.  In the meantime while we fix the bug (I will file an issue to be resolved), you may want to use the text callback:</div><div><br></div><div>

If you want some text over on the right side near the colorbar, you should have decent luck with:</div><div><br></div><div>p.modify['text']((1.15,0.9), 'z=%.2f'%z)</div><div><br></div><div>or if you want to place it in the middle, which you'd probably want the color to be white, you could do something like:</div>

<div><br></div><div>p.modify['text']((0.5,0.9), 'z=%.2f'%0.1, text_args={'color':'w'})</div><div><br>The numbers in the () denote the fractional position in x,y in the image part of the plot.  In both of those examples, I'm assuming you've defined z somewhere, otherwise is will still fail. </div>

<div><br></div><div>Best,</div><div>Sam<br><br><div class="gmail_quote">On Tue, Jul 17, 2012 at 1:56 AM, Pengfei Chen <span dir="ltr"><<a href="mailto:madcpf@gmail.com" target="_blank">madcpf@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Nathan,<br>
<br>
Thank you very much for your reply! There is no error message after<br>
this modification, but there is still no title on the pdf/png I get.<br>
It's strange.<br>
<br>
Pengfei<br>
<br>
2012/7/16 Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com">nathan12343@gmail.com</a>>:<br>
<div class="HOEnZb"><div class="h5">> Hi Pengfei,<br>
><br>
> I think you want to replace this line:<br>
><br>
><br>
> p.modify["title"](halos, text='z=%.2f'%z)<br>
><br>
><br>
> With the following:<br>
><br>
> p.modify["title"]('z=%.2f'%z)<br>
><br>
><br>
> Cheers,<br>
><br>
> Nathan<br>
><br>
><br>
> On 7/16/12 5:34 PM, Pengfei Chen wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> I'm trying to add a title for the picture, but I can't find the right<br>
>> command to do so. Here is the code:<br>
>><br>
>> pf = load(fn)<br>
>> halos = HaloFinder(pf)<br>
>> pc = PlotCollection(pf, [pos_x, pos_y, pos_z])<br>
>> p = pc.add_slice("Density", 0)<br>
>> pc.set_width(3*rad, '1')<br>
>> p.modify["hop_particles"](halos, max_number=100, alpha=0.3)<br>
>> p.modify["title"](halos, text='z=%.2f'%z)<br>
>><br>
>> And there is some error reported for the last line. The meaning of the<br>
>> error is more than one name is given to the title. Then I replace it<br>
>> with:<br>
>><br>
>> p.modify["text"](halos, pos=(0.02, 0.98), text='z=%.2f'%z)<br>
>><br>
>> But it still has error. Could someone please help me about it?<br>
>><br>
>> Pengfei<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>
><br>
><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>
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>
</div></div></blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>yt-users mailing list</span><br><span><a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a></span><br><span><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a></span><br></div></blockquote></body></html>