yt.visualization.plot_modifications.TimestampCallback

class yt.visualization.plot_modifications.TimestampCallback(x_pos=None, y_pos=None, corner='lower_left', time=True, redshift=False, time_format="t = {time:.0f} {units}", time_unit=None, redshift_format="z = {redshift:.2f}", draw_inset_box=False, coord_system='axis', text_args=None, inset_box_args=None)[source]

Annotates the timestamp and/or redshift of the data output at a specified location in the image (either in a present corner, or by specifying (x,y) image coordinates with the x_pos, y_pos arguments. If no time_units are specified, it will automatically choose appropriate units. It allows for custom formatting of the time and redshift information, as well as the specification of an inset box around the text.

Parameters:

x_pos, y_pos : floats, optional

The image location of the timestamp in the coord system defined by the coord_system kwarg. Setting x_pos and y_pos overrides the corner parameter.

corner : string, optional

Corner sets up one of 4 predeterimined locations for the timestamp to be displayed in the image: ‘upper_left’, ‘upper_right’, ‘lower_left’, ‘lower_right’ (also allows None). This value will be overridden by the optional x_pos and y_pos keywords.

time : boolean, optional

Whether or not to show the ds.current_time of the data output. Can be used solo or in conjunction with redshift parameter.

redshift : boolean, optional

Whether or not to show the ds.current_time of the data output. Can be used solo or in conjunction with the time parameter.

time_format : string, optional

This specifies the format of the time output assuming “time” is the number of time and “unit” is units of the time (e.g. ‘s’, ‘Myr’, etc.) The time can be specified to arbitrary precision according to printf formatting codes (defaults to .1f – a float with 1 digits after decimal). Example: “Age = {time:.2f} {units}”.

time_unit : string, optional

time_unit must be a valid yt time unit (e.g. ‘s’, ‘min’, ‘hr’, ‘yr’, ‘Myr’, etc.)

redshift_format : string, optional

This specifies the format of the redshift output. The redshift can be specified to arbitrary precision according to printf formatting codes (defaults to 0.2f – a float with 2 digits after decimal). Example: “REDSHIFT = {redshift:03.3g}”,

draw_inset_box : boolean, optional

Whether or not an inset box should be included around the text If so, it uses the inset_box_args to set the matplotlib FancyBboxPatch object.

coord_system : string, optional

This string defines the coordinate system of the coordinates of pos Valid coordinates are:

“data” – the 3D dataset coordinates

“plot” – the 2D coordinates defined by the actual plot limits

“axis” – the MPL axis coordinates: (0,0) is lower left; (1,1) is

upper right

“figure” – the MPL figure coordinates: (0,0) is lower left, (1,1)

is upper right

text_args : dictionary, optional

A dictionary of any arbitrary parameters to be passed to the Matplotlib text object. Defaults: {‘color’:’white’, ‘horizontalalignment’:’center’, ‘verticalalignment’:’top’}.

inset_box_args : dictionary, optional

A dictionary of any arbitrary parameters to be passed to the Matplotlib FancyBboxPatch object as the inset box around the text. Defaults: {‘boxstyle’:’square,pad=0.3’, ‘facecolor’:’black’,

‘linewidth’:3, ‘edgecolor’:’white’, ‘alpha’:0.5}

Methods