Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
MNT: set the facecolor of nofill markers#17850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -4490,6 +4490,10 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, | ||
| "s must be a scalar, " | ||
| "or float array-like with the same size as x and y") | ||
| # get the original edgecolor the user passed before we normalize | ||
| orig_edgecolor = edgecolors | ||
| if edgecolors is None: | ||
| orig_edgecolor = kwargs.get('edgecolor', None) | ||
| c, colors, edgecolors = \ | ||
| self._parse_scatter_color_args( | ||
| c, edgecolors, kwargs, x.size, | ||
| @@ -4518,6 +4522,36 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, | ||
| path = marker_obj.get_path().transformed( | ||
| marker_obj.get_transform()) | ||
| if not marker_obj.is_filled(): | ||
| if orig_edgecolor is not None: | ||
| _api.warn_external( | ||
| f"You passed a edgecolor/edgecolors ({orig_edgecolor!r}) " | ||
| f"for an unfilled marker ({marker!r}). Matplotlib is " | ||
| "ignoring the edgecolor in favor of the facecolor. This " | ||
| "behavior may change in the future." | ||
| ) | ||
| # We need to handle markers that can not be filled (like | ||
| # '+' and 'x') differently than markers that can be | ||
| # filled, but have their fillstyle set to 'none'. This is | ||
| # to get: | ||
| # | ||
| # - respecting the fillestyle if set | ||
| # - maintaining back-compatibility for querying the facecolor of | ||
| # the un-fillable markers. | ||
| # | ||
| # While not an ideal situation, but is better than the | ||
| # alternatives. | ||
| if marker_obj.get_fillstyle() == 'none': | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I'm still somewhat confused why we need special-casing in the drawing function. Could this not be handled in the | ||
| # promote the facecolor to be the edgecolor | ||
| edgecolors = colors | ||
| # set the facecolor to 'none' (at the last chance) because | ||
| # we can not not fill a path if the facecolor is non-null. | ||
| # (which is defendable at the renderer level) | ||
| colors = 'none' | ||
| else: | ||
| # if we are not nulling the face color we can do this | ||
| # simpler | ||
| edgecolors = 'face' | ||
| if linewidths is None: | ||
| linewidths = rcParams['lines.linewidth'] | ||
| elif np.iterable(linewidths): | ||
| @@ -4529,8 +4563,8 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, | ||
| collection = mcoll.PathCollection( | ||
| (path,), scales, | ||
| facecolors=colors, | ||
| edgecolors=edgecolors, | ||
| linewidths=linewidths, | ||
| offsets=offsets, | ||
| transOffset=kwargs.pop('transform', self.transData), | ||