mpl.unpack_labeled_data()

mpl.unpack_labeled_data(replace_names=None, replace_all_args=False, label_namer=None, positional_parameter_names=None)[source]

A decorator to add a ‘data’ kwarg to any a function. The signature of the input function must include the ax argument at the first position

def foo(ax, *args, **kwargs)

so this is suitable for use with Axes methods.

Parameters:

replace_names : list of strings, optional, default: None

The list of parameter names which arguments should be replaced by data[name]. If None, all arguments are replaced if they are included in data.

replace_all_args : bool, default: False

If True, all arguments in *args get replaced, even if they are not in replace_names.

label_namer : string, optional, default: None

The name of the parameter which argument should be used as label, if label is not set. If None, the label keyword argument is not set.

positional_parameter_names : list of strings or callable, optional

The full list of positional parameter names (excluding an explicit ax/’self’ argument at the first place and including all possible positional parameter in *args), in the right order. Can also include all other keyword parameter. Only needed if the wrapped function does contain *args and (replace_names is not None or replace_all_args is False). If it is a callable, it will be called with the actual tuple of *args and the data and should return a list like above. NOTE: callables should only be used when the names and order of *args can only be determined at runtime. Please use list of names when the order and names of *args is clear before runtime!