Dear Nathan,<div><br></div><div>Thank you for you help.</div><div>However, when I try to follow your suggestion, yt complains that </div><div>>> slc.set_font(font_dict)<div>>> AttributeError: 'ProjectionPlot' object has no attribute 'set_font'</div>
<div>Meanwhile, I try your approach only for annotate_text then it works.</div><div>So, now I can control the text size but I still can not find how increase x y label and tick size.</div><div>Is there other way to do so?</div>
<div><br></div><div>Thank you,</div><div>Junhwan</div><div><br></div><br><div class="gmail_quote">On Mon, Mar 25, 2013 at 10:46 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@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 Junhwan,<br></div><div><br></div><div>You can set the font properties using the set_font function:</div>
<div><br></div><div><div>>>> slc = SlicePlot(pf, 'x', 'Density')</div>
<div>>>> font_dict = {'family':'sans-serif', 'style':'italic',</div><div> 'weight':'bold', 'size':24}</div><div>>>> slc.set_font(font_dict)</div>
<div><br></div><div>Here, font_dict is a dictionary of keywords that will be passed to the matplotlib FontProperties object for the plot. For more details about FontProperties, take a look at the matplotlib documentation: <a href="http://matplotlib.org/api/font_manager_api.html#matplotlib.font_manager.FontProperties" target="_blank">http://matplotlib.org/api/font_manager_api.html#matplotlib.font_manager.FontProperties</a></div>
<div><br></div><div>One caveat is that the axes labels use MathText which is tied to a special computer modern font that is bundled with matplotlib. For that reason, you will only be able to adjust the size of the axes labels, not the font.</div>
<div><br></div><div>Another caveat is that you cannot set the tick label color using set_font. Instead, you'll need to iterate over the actual tick label objects as in this example from the docs: <a href="http://yt-project.org/doc/cookbook/simple_plots.html?highlight=dinosaurs#accessing-and-modifying-plots-directly" target="_blank">http://yt-project.org/doc/cookbook/simple_plots.html?highlight=dinosaurs#accessing-and-modifying-plots-directly</a></div>
<div><br></div><div>Finally, you'll need to set the font properties for the text annotation separately:<br></div><div><br></div><div>>>> <span style="font-family:arial,sans-serif;font-size:13px">slc.annotate_text((-45,42.5), "a)", data_coords=False, text_args = font_dict)</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">The text_args keyword of annoate_text does accept color as a keyword, so you'll be able to pass it in with font_dict.</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">The full list of allowed keywords for text_args is on this page from the matplotlib docs: </span><font face="arial, sans-serif"><a href="http://matplotlib.org/users/text_props.html" target="_blank">http://matplotlib.org/users/text_props.html</a></font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Hope that's helpful. Sorry that's not as simple as it could be, this is one area of the plotting routines where it would be nice to simplify things.</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">-Nathan</font></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Mon, Mar 25, 2013 at 6:13 PM, Jun-Hwan Choi <span dir="ltr"><<a href="mailto:jhchoi@pa.uky.edu" target="_blank">jhchoi@pa.uky.edu</a>></span> wrote:<br>
</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><div class="h5">Hi yt user,<div><br></div>
<div>I make a very simple projection plot using following script:</div>
<div><div><br></div><div>==========</div><div>from yt.mods import *</div><div><br></div><div># Load the dataset.</div><div>pf = load("../RunDM1/DD0134/DD0134")</div>
<div>center = na.array([0.5,0.5,0.5,])</div><div><br></div><div># Making slice</div><div>slc = ProjectionPlot(pf, 2,'Density', center,(100, 'pc') , 'Density')</div><div>slc.annotate_text((-45,42.5), "a)", data_coords=False)</div>
<div>slc.save("Run1")</div><div>==========</div><div><br></div><div>It generate plot with x, y, z labels and ticks as well text "a)"</div><div>I would like to increase the font size of label, ticks, and text.</div>
<div>I also change the color of the text.</div><div>I think it is very basic operation, but I can not find the way.</div><div>Can anyone help me?</div><div><br></div><div>Thanks in advance,</div><div>Junhwan</div><span><font color="#888888"><br clear="all">
<div><br></div>-- <br>--------------------------------------------------------------<br>Jun-Hwan Choi, Ph.D.<br>Department of Physics and Astronomy, University of Kentucky<br>Tel: <a href="tel:%28859%29%20897-6737" value="+18598976737" target="_blank">(859) 897-6737</a> Fax: <a href="tel:%28859%29%20323-2846" value="+18593232846" target="_blank">(859) 323-2846</a><br>
Email: <a href="mailto:jhchoi@pa.uky.edu" target="_blank">jhchoi@pa.uky.edu</a> URL: <a href="http://www.pa.uky.edu/~jhchoi" target="_blank">http://www.pa.uky.edu/~jhchoi</a><br>--------------------------------------------------------------<br>
<br>
</font></span></div>
<br></div></div>_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">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></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>--------------------------------------------------------------<br>Jun-Hwan Choi, Ph.D.<br>Department of Physics and Astronomy, University of Kentucky<br>Tel: (859) 897-6737 Fax: (859) 323-2846<br>
Email: <a href="mailto:jhchoi@pa.uky.edu" target="_blank">jhchoi@pa.uky.edu</a> URL: <a href="http://www.pa.uky.edu/~jhchoi" target="_blank">http://www.pa.uky.edu/~jhchoi</a><br>--------------------------------------------------------------<br>
<br>
</div>