Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be57aac

Browse files
sanrishitimhoffm
andauthored
MNT: Discourage Artist.update (#30978)
Co-authored-by: Tim Hoffmann <[email protected]>
1 parent 51fbfc4 commit be57aac

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

lib/matplotlib/artist.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,11 +1242,26 @@ def _update_props(self, props, errfmt):
12421242

12431243
def update(self, props):
12441244
"""
1245-
Update this artist's properties from the dict *props*.
1245+
[*Discouraged*] Update this artist's properties from the dictionary *props*.
1246+
1247+
.. admonition:: Discouraged
1248+
1249+
This method exists for historic reasons. Please use `.Artist.set` instead.
1250+
``artist.update(props)`` is nowadays almost identical to
1251+
``artist.set(**props)`` with the only difference that ``set`` will
1252+
additionally check that a property is not specified multiple times
1253+
through aliases.
12461254
12471255
Parameters
12481256
----------
12491257
props : dict
1258+
Dictionary of properties (keys) and their new values.
1259+
1260+
Returns
1261+
-------
1262+
list
1263+
A list of return values from the configured setters.
1264+
12501265
"""
12511266
return self._update_props(
12521267
props, "{cls.__name__!r} object has no property {prop_name!r}")

0 commit comments

Comments
 (0)