<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 19, 2015 at 4:38 PM, DORIS LEE <span dir="ltr"><<a href="mailto:dorislee@berkeley.edu" target="_blank">dorislee@berkeley.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Hi all,<br></div><div>I am trying to adjust the fontsize of the title and text of a yt SlicePlot. It looks like TitleCallback could be used to make the plot setting same as the font attributes set in the SlicePlot, but it errors because SlicePlot doesn't have an axes.Is there a simpler way to feed in a plot_args diction in the parameter for these plot annotate_title and annotate_text functions?</div><div>Thank you.</div><div><br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">ds= yt.load("output_00001/info_00001.txt")</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">slc = yt.SlicePlot(ds, "z","density" ,window_size=7)</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">slc.set_font_size(20)</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">title=yt.visualization.plot_modifications.TitleCallback("title")</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">title(slc)</blockquote></blockquote></blockquote></div></blockquote><div><br></div><div>Hi Doris,</div><div><br></div><div>This isn't the proper way to call the title callback. There's some magic in the PlotWindow class to associate the TitleCallback class with the annotate_title function. The line you've commented out below is the proper way to do it. The TitleCallback class itself is a part of yt's internals and should not be used directly in your scripts.</div><div><br></div><div>As Cameron pointed out, as of yt 3.2 the text callback accepts a `coord_system` keyword argument. The fact that it failed for you indicates that you're likely on yt-3.1 before that functionality was added. I'd urge you to update to the latest stable version of yt (version 3.2.1) which includes a large number of fixes for bugs in the version you're using. There are instructions on how to update your yt installation here:</div><div><br></div><div><a href="http://yt-project.org/doc/installing.html">http://yt-project.org/doc/installing.html</a><br></div><div><br></div><div>If you installed using the install script or from a clone of the yt mercurial repository, it should be as easy as doing "yt update". If you installed using pip, you should be able to do "pip install -U yt" (might need additional command line arguments depending on your python installation, described in the link above), and if you installed using conda you should be able to do "conda update yt".</div><div><br></div><div>I've uploaded a notebook here that I evaluated using yt 3.2.1 and one of the public test datasets on <a href="http://yt-project.org/data">yt-project.org/data</a>:</div><div><br></div><div><div><a href="https://gist.github.com/e3fb912480c0ac25fcf8">https://gist.github.com/e3fb912480c0ac25fcf8</a></div></div><div><br></div><div>It demonstrates the functionality that Cameron and I are discussing.</div><div><br></div><div>Hope that helps,</div><div><br></div><div>Nathan</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"># slc.annotate_title("Test")</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">slc.annotate_text((0,1),"timestep #:")</blockquote></blockquote></blockquote><div><br></div><div style="padding:0px;display:flex;color:rgb(0,0,0);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:20px"><div style="padding:0.4em;max-width:calc(100% - 14ex);line-height:1.21429em"><pre style="overflow:auto;padding:0px;margin-top:0px;margin-bottom:0px;line-height:inherit;word-wrap:break-word;border:0px;border-radius:0px;white-space:pre-wrap;vertical-align:baseline;background-color:transparent"><span style="color:rgb(70,130,180)"><span style="color:rgb(0,100,0)"><span style="color:rgb(196,160,0)"><span style="color:rgb(70,130,180)"><span style="color:rgb(0,100,0)"><span style="color:rgb(70,130,180)"><span style="color:rgb(0,100,0)"><pre style="overflow:auto;padding:0px;margin-top:0px;margin-bottom:0px;line-height:17.0001px;word-wrap:break-word;color:rgb(0,0,0);border:0px;border-radius:0px;white-space:pre-wrap;vertical-align:baseline"><span style="color:rgb(139,0,0)">---------------------------------------------------------------------------</span>
<span style="color:rgb(139,0,0)">AttributeError</span>                            Traceback (most recent call last)
<span style="color:rgb(0,100,0)"><ipython-input-63-fc5ce857c791></span> in <span style="color:rgb(70,130,180)"><module><span style="color:rgb(0,0,139)">()</span>
<span style="color:rgb(0,100,0)">      3</span> slc<span style="color:rgb(196,160,0)">.</span>set_font_size<span style="color:rgb(196,160,0)">(</span><span>20</span><span style="color:rgb(196,160,0)">)</span><span style="color:rgb(196,160,0)"></span>
<span style="color:rgb(0,100,0)">      4</span> title<span style="color:rgb(196,160,0)">=</span>yt<span style="color:rgb(196,160,0)">.</span>visualization<span style="color:rgb(196,160,0)">.</span>plot_modifications<span style="color:rgb(196,160,0)">.</span>TitleCallback<span style="color:rgb(196,160,0)">(</span><span style="color:rgb(0,0,139)">"title"</span><span style="color:rgb(196,160,0)">)</span><span style="color:rgb(196,160,0)"></span>
<span style="color:rgb(0,100,0)">----> 5<span style="color:rgb(196,160,0)"> </span>title<span style="color:rgb(196,160,0)">(</span>slc<span style="color:rgb(196,160,0)">)</span><span style="color:rgb(196,160,0)"></span>
<span>      6</span> <span style="color:rgb(139,0,0)"># slc.annotate_title("Test")</span><span style="color:rgb(196,160,0)"></span><span style="color:rgb(196,160,0)"></span>
<span>      7</span> slc<span style="color:rgb(196,160,0)">.</span>annotate_text<span style="color:rgb(196,160,0)">(</span><span style="color:rgb(196,160,0)">(</span><span style="color:rgb(70,130,180)">0</span><span style="color:rgb(196,160,0)">,</span><span style="color:rgb(70,130,180)">1</span><span style="color:rgb(196,160,0)">)</span><span style="color:rgb(196,160,0)">,</span><span style="color:rgb(0,0,139)">"timestep #:"</span><span style="color:rgb(196,160,0)">)</span><span style="color:rgb(196,160,0)"></span>

<span>/global/homes/d/dorislee/mypythonpackages/yt/visualization/plot_modifications.pyc</span> in <span style="color:rgb(70,130,180)">__call__<span style="color:rgb(0,0,139)">(self, plot)</span>
<span style="color:rgb(0,100,0)">   1087</span> <span style="color:rgb(196,160,0)"></span>
<span style="color:rgb(0,100,0)">   1088</span>     <span style="color:rgb(0,100,0)">def</span> __call__<span style="color:rgb(196,160,0)">(</span>self<span style="color:rgb(196,160,0)">,</span>plot<span style="color:rgb(196,160,0)">)</span><span style="color:rgb(196,160,0)">:</span><span style="color:rgb(196,160,0)"></span>
<span style="color:rgb(0,100,0)">-> 1089<span style="color:rgb(196,160,0)">         </span>plot<span style="color:rgb(196,160,0)">.</span>_axes<span style="color:rgb(196,160,0)">.</span>set_title<span style="color:rgb(196,160,0)">(</span>self<span style="color:rgb(196,160,0)">.</span>title<span style="color:rgb(196,160,0)">)</span><span style="color:rgb(196,160,0)"></span>
<span>   1090</span> <span style="color:rgb(196,160,0)"></span>
<span>   1091</span> <span>class</span> TimestampCallback<span style="color:rgb(196,160,0)">(</span>PlotCallback<span style="color:rgb(196,160,0)">)</span><span style="color:rgb(196,160,0)">:</span><span style="color:rgb(196,160,0)"></span>

<span style="color:rgb(139,0,0)">AttributeError</span>: 'AxisAlignedSlicePlot' object has no attribute '_axes'</span></span></span></span></pre></span></span></span></span></span></span></span></pre></div></div><span class=""><font color="#888888"><div><br></div><div><br></div><div>Doris</div></font></span></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" rel="noreferrer" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div></div>