Public API for resolving artist property aliases

Is there a method for consuming a dict of kwargs that’s on its way to a matplotlib artist and returning a dict where the short-form aliases have been expanded to their long form and removed?

e.g.

line_kwargs = dict(linewidth=3, ls="--", c="r")
line_kwargs_clean = Line2D.resolve_kwargs(line_kwargs)
line_kwargs_clean
{"linewidth": 3, "linestyle": "--", "color": "r"}
1 Like

There is a helper function in matplotlib.cbook normalize_kwargs (source) . You pass either a manually curated re-mapping and an Artist sub-class that has a mapping attached to it.

3 Likes