diff --git a/doc/api/next_api_changes/behavior/20077-TH.rst b/doc/api/next_api_changes/behavior/20077-TH.rst new file mode 100644 index 000000000000..63dac85d795b --- /dev/null +++ b/doc/api/next_api_changes/behavior/20077-TH.rst @@ -0,0 +1,7 @@ +``Artist.set`` applies artist properties in the order in which they are given +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The change only affects the interaction between the *color*, *edgecolor*, +*facecolor*, and, for `.Collection`\s, *alpha* properties: the *color* property +now needs to be passed first in order not to override the other properties. +This is consistent with e.g. `.Artist.update`, which did not reorder the +properties passed to it. diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py index 406e9db5ae54..b7f8e42d081a 100644 --- a/lib/matplotlib/artist.py +++ b/lib/matplotlib/artist.py @@ -1152,30 +1152,6 @@ def properties(self): def set(self, **kwargs): """A property batch setter. Pass *kwargs* to set properties.""" kwargs = cbook.normalize_kwargs(kwargs, self) - move_color_to_start = False - if "color" in kwargs: - keys = [*kwargs] - i_color = keys.index("color") - props = ["edgecolor", "facecolor"] - if any(tp.__module__ == "matplotlib.collections" - and tp.__name__ == "Collection" - for tp in type(self).__mro__): - props.append("alpha") - for other in props: - if other not in keys: - continue - i_other = keys.index(other) - if i_other < i_color: - move_color_to_start = True - _api.warn_deprecated( - "3.3", message=f"You have passed the {other!r} kwarg " - "before the 'color' kwarg. Artist.set() currently " - "reorders the properties to apply 'color' first, but " - "this is deprecated since %(since)s and will be " - "removed %(removal)s; please pass 'color' first " - "instead.") - if move_color_to_start: - kwargs = {"color": kwargs.pop("color"), **kwargs} return self.update(kwargs) def findobj(self, match=None, include_self=True):