<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Junhwan,<div><br></div><div>I can provide you a quick hack to do this, while it is ugly and be careful to save your backup file.</div><div><br></div><div>In the file:</div><div><br></div><div>src/yt-hg/yt/visualization/plot_window.py</div><div><br></div><div>You could search for the following lines:</div><div><br></div><div><div><font face="DejaVu LGC Sans Mono">class PlotWindow(object):</font></div><div><font face="DejaVu LGC Sans Mono"> _plot_valid = False</font></div><div><font face="DejaVu LGC Sans Mono"> _colorbar_valid = False</font></div><div><font face="DejaVu LGC Sans Mono"> _contour_info = None</font></div><div><font face="DejaVu LGC Sans Mono"> _vector_info = None</font></div><div><font face="DejaVu LGC Sans Mono"> _frb = None</font></div><div><font face="DejaVu LGC Sans Mono"> def __init__(self, data_source, bounds, buff_size=(800,800), antialias=True,</font></div><div><font face="DejaVu LGC Sans Mono"> periodic=True, origin='center-window', oblique=False, fontsize=15):</font></div></div><div><br></div><div>In the last line, change the font size to a larger number.</div><div><br></div><div>After that you'll find both the ticks and labels of axis and colorbar become larger. However, if you use log plot, you'll find the exponent number at the top of the axis remains small. Then you could add these in your own script:</div><div><br></div><div><font face="DejaVu LGC Sans Mono">import matplotlib</font></div><div><font face="DejaVu LGC Sans Mono"><br></font></div><div><font face="DejaVu LGC Sans Mono">matplotlib.rcParams.update({'font.size': YOURSIZE})</font></div><div><br></div><div>My yt version might be a little out-of-date, so please also be cautious when you do the modification. Hope it works for you, although it's not an elegant way...</div><div><br></div><div>Best wishes,</div><div>Suoqing</div><div><br></div><div><br><div><div>On Mar 25, 2013, at 11:38 PM, Jun-Hwan Choi <<a href="mailto:jhchoi@pa.uky.edu">jhchoi@pa.uky.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">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: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><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>
_______________________________________________<br>yt-users mailing list<br><a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org<br></blockquote></div><br></div></body></html>