arviz_base.labels.MapLabeller

arviz_base.labels.MapLabeller#

class arviz_base.labels.MapLabeller(var_name_map=None, dim_map=None, coord_map=None)[source]#

Labeller class to perform provided replacements to elements when converting to string.

It is a subclass of BaseLabeller so the base behaviour is the same, but we can define replacements through dictionaries when initializing the class.

The default labels for “theta” variable on the subset corresponding to “chain” 0 and “school” “Name” with a replacement mapping on the variable name {"theta": "θ"} and one on the coordinate values {"Name": "𝑁𝑎𝑚𝑒"}

Single line label#
θ[0, 𝑁𝑎𝑚𝑒]
Multi-line label#
θ
0, 𝑁𝑎𝑚𝑒

See also

Label guide

Tutorial page on using labellers with ArviZ

__init__(var_name_map=None, dim_map=None, coord_map=None)[source]#

Initialize a MapLabeller class.

Parameters:
var_name_map, dim_mapmapping of {hashablehashable}, optional

Keys are existing names and values are their respective desired labels.

coord_mapmapping of {hashablemapping of {hashablehashable}}, optional

The keys of the first level dictionary are dimension names, the inner dictionary has existing coord names as keys and their corresponding desired label as values.

Methods

__init__([var_name_map, dim_map, coord_map])

Initialize a MapLabeller class.

dim_coord_to_str(dim, coord_val, coord_idx)

Format a single dimension name, its value and positional indexes as a string.

make_label_flat(var_name, sel, isel)

Format variable name and corresponding subset as a single line string.

make_label_vert(var_name, sel, isel)

Format variable name and corresponding subset as a multiline string.

make_pp_label(var_name, pp_var_name, sel, isel)

Format obs+pp variable name plus corresponding subsets as a multiline string.

sel_to_str(sel, isel)

Format selection dictionaries as a string.

var_name_to_str(var_name)

Format a variable name as a string.

var_pp_to_str(var_name, pp_var_name)

Format the corresponding variable names for observation and posterior predictive.