Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c316bd1

Browse filesBrowse files
committed
Expire Artist.set() property reordering
1 parent 8188d31 commit c316bd1
Copy full SHA for c316bd1

File tree

Expand file treeCollapse file tree

2 files changed

+7
-24
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-24
lines changed
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
``Artist.set`` applies artist properties in the order in which they are given
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
The change only affects the interaction between the *color*, *edgecolor*,
4+
*facecolor*, and, for `.Collection`\s, *alpha* properties: the *color* property
5+
now needs to be passed first in order not to override the other properties.
6+
This is consistent with e.g. `.Artist.update`, which did not reorder the
7+
properties passed to it.

‎lib/matplotlib/artist.py

Copy file name to clipboardExpand all lines: lib/matplotlib/artist.py
-24Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,30 +1152,6 @@ def properties(self):
11521152
def set(self, **kwargs):
11531153
"""A property batch setter. Pass *kwargs* to set properties."""
11541154
kwargs = cbook.normalize_kwargs(kwargs, self)
1155-
move_color_to_start = False
1156-
if "color" in kwargs:
1157-
keys = [*kwargs]
1158-
i_color = keys.index("color")
1159-
props = ["edgecolor", "facecolor"]
1160-
if any(tp.__module__ == "matplotlib.collections"
1161-
and tp.__name__ == "Collection"
1162-
for tp in type(self).__mro__):
1163-
props.append("alpha")
1164-
for other in props:
1165-
if other not in keys:
1166-
continue
1167-
i_other = keys.index(other)
1168-
if i_other < i_color:
1169-
move_color_to_start = True
1170-
_api.warn_deprecated(
1171-
"3.3", message=f"You have passed the {other!r} kwarg "
1172-
"before the 'color' kwarg. Artist.set() currently "
1173-
"reorders the properties to apply 'color' first, but "
1174-
"this is deprecated since %(since)s and will be "
1175-
"removed %(removal)s; please pass 'color' first "
1176-
"instead.")
1177-
if move_color_to_start:
1178-
kwargs = {"color": kwargs.pop("color"), **kwargs}
11791155
return self.update(kwargs)
11801156

11811157
def findobj(self, match=None, include_self=True):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.