yt.visualization.plot_modifications.
TextLabelCallback
(pos, text, data_coords=False, coord_system='data', text_args=None, inset_box_args=None)[source]¶Overplot text on the plot at a specified position. If you desire an inset box around your text, set one with the inset_box_args dictionary keyword.
Parameters: | pos : 2- or 3-element tuple, list, or array
text : string
coord_system : string, optional
text_args : dictionary, optional
inset_box_args : dictionary, optional
|
---|
Examples
>>> # Overplot white text at data location [0.55, 0.7, 0.4]
>>> import yt
>>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
>>> s = yt.SlicePlot(ds, 'z', 'density')
>>> s.annotate_text([0.55, 0.7, 0.4], "Here is a galaxy")
>>> s.save()
>>> # Overplot yellow text at axis location [0.2, 0.8] with
>>> # a shaded inset box
>>> import yt
>>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
>>> s = yt.SlicePlot(ds, 'z', 'density')
>>> s.annotate_text([0.2, 0.8], "Here is a galaxy", coord_system='axis',
... text_args={'color':'yellow'},
... inset_box_args={'boxstyle':'square,pad=0.3',
... 'facecolor':'black',
... 'linewidth':3,
... 'edgecolor':'white', 'alpha':0.5})
>>> s.save()
Methods