matplotlib 3.5.1

Parameters
_preprocess_data(func=None, *, replace_names=None, label_namer=None)

When applied:

@_preprocess_data()
def func(ax, *args, **kwargs): ...

the signature is modified to decorated(ax, *args, data=None, **kwargs) with the following behavior:

In either case, any argument that is a :None:None:`MappingView` is also converted to a list.

Parameters

replace_names : list of str or None, default: None

The list of parameter names for which lookup into data should be attempted. If None, replacement is attempted for all arguments.

label_namer : str, default: None

If set e.g. to "namer" (which must be a kwarg in the function's signature -- not as **kwargs ), if the namer argument passed in is a (string) key of data and no label kwarg is passed, then use the (string) value of the namer as label. :

@_preprocess_data(label_namer="foo")
def func(foo, label=None): ...

func("key", data={"key": value})
# is equivalent to
func.__wrapped__(value, label="key")

A decorator to add a 'data' kwarg to a function.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/__init__.py#1338
type: <class 'function'>
Commit: