tardis.visualization.plot_util module

Utility functions to be used in plotting.

tardis.visualization.plot_util.axis_label_in_latex(label_text, unit, only_text=True)[source]

Get axis label for plotly plots that can show units in latex.

Parameters:
label_textstr

Text to show on label, may be expressed in latex

unitastropy.units

Unit of the label which needs to be expressed in latex

only_textbool

If label_text is expressed purely in text (i.e. without using latex) or not. Default value is True

Returns:
str

Latex string for label renderable by plotly

tardis.visualization.plot_util.get_mid_point_idx(arr)[source]

Get index of the middle point of a sorted array (ascending or descending).

The values in array may not be evenly distributed so it picks the middle point not by index but by their values.

Parameters:
arrnp.array
Returns:
int
tardis.visualization.plot_util.to_rgb255_string(color_tuple)[source]

Convert a matplotlib RGBA tuple to a generic RGB 255 string.

Parameters:
color_tupletuple

Matplotlib RGBA tuple of float values in closed interval [0, 1]

Returns:
str

RGB string of format rgb(r,g,b) where r,g,b are integers between 0 and 255 (both inclusive)