[yt-users] Adjusting fontsize on yt SlicePlot

Cameron Hummels chummels at gmail.com
Sat Sep 19 15:09:31 PDT 2015


Hi Doris,

The font properties of any of the annotations should be the same as the
general font properties of the plot by default.  So when you changed the
font size of the plot, it should equally affect the text and title
annotations.  Like this:

import yt
ds= yt.load("output_00001/info_00001.txt")
slc = yt.SlicePlot(ds, "z","density" ,window_size=7)
slc.set_font_size(20)
slc.annotate_title("Test")
slc.annotate_text((0.1, 0.1),"timestep #:", coord_system='axis')

Does this not work for you?  It works for me OK using the latest version on
the "yt" branch (dev), but it should work in all versions.  Or am I
misunderstanding your question?

For more info on the annotations, check out this docs page and this recipe:

http://yt-project.org/docs/dev/visualizing/callbacks.html
http://yt-project.org/docs/dev/cookbook/simple_plots.html#annotations-recipe

Cameron

On Sat, Sep 19, 2015 at 2:38 PM, DORIS LEE <dorislee at berkeley.edu> wrote:

> Hi all,
> 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?
> Thank you.
>
>
> ds= yt.load("output_00001/info_00001.txt")
>>>
>>> slc = yt.SlicePlot(ds, "z","density" ,window_size=7)
>>>
>>> slc.set_font_size(20)
>>>
>>> title=yt.visualization.plot_modifications.TitleCallback("title")
>>>
>>> title(slc)
>>>
>>> # slc.annotate_title("Test")
>>>
>>> slc.annotate_text((0,1),"timestep #:")
>>>
>>>
> ---------------------------------------------------------------------------AttributeError                            Traceback (most recent call last)<ipython-input-63-fc5ce857c791> in <module>()      3 slc.set_font_size(20)      4 title=yt.visualization.plot_modifications.TitleCallback("title")----> 5 title(slc)      6 # slc.annotate_title("Test")      7 slc.annotate_text((0,1),"timestep #:")
> /global/homes/d/dorislee/mypythonpackages/yt/visualization/plot_modifications.pyc in __call__(self, plot)   1087    1088     def __call__(self,plot):-> 1089         plot._axes.set_title(self.title)   1090    1091 class TimestampCallback(PlotCallback):
> AttributeError: 'AxisAlignedSlicePlot' object has no attribute '_axes'
>
>
>
> Doris
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>


-- 
Cameron Hummels
NSF Postdoctoral Fellow
Department of Astronomy
California Institute of Technology
http://chummels.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150919/a576b702/attachment.htm>


More information about the yt-users mailing list