Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def draw(self, renderer):
edgecolors = self.get_edgecolor()
do_single_path_optimization = False
if (len(paths) == 1 and len(trans) <= 1 and
len(facecolors) == 1 and len(edgecolors) == 1 and
len(facecolors) <= 1 and len(edgecolors) <= 1 and
len(self._linewidths) == 1 and
all(ls[1] is None for ls in self._linestyles) and
len(self._antialiaseds) == 1 and len(self._urls) == 1 and
Expand All @@ -414,14 +414,16 @@ def draw(self, renderer):
gc.set_capstyle(self._capstyle)

if do_single_path_optimization:
gc.set_foreground(tuple(edgecolors[0]), isRGBA=True)
edgecolor = edgecolors[0] if len(edgecolors) == 1 else (0, 0, 0, 0)
facecolor = facecolors[0] if len(facecolors) == 1 else (0, 0, 0, 0)
gc.set_foreground(tuple(edgecolor), isRGBA=True)
gc.set_linewidth(self._linewidths[0])
gc.set_dashes(*self._linestyles[0])
gc.set_antialiased(self._antialiaseds[0])
gc.set_url(self._urls[0])
renderer.draw_markers(
gc, paths[0], combined_transform.frozen(),
mpath.Path(offsets), offset_trf, tuple(facecolors[0]))
mpath.Path(offsets), offset_trf, tuple(facecolor))
else:
# The current new API of draw_path_collection() is provisional
# and will be changed in a future PR.
Expand Down
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3217,6 +3217,16 @@ def test_scatter_singular_plural_arguments(self):
facecolors=["#ffffff", "#000000", "#f0f0f0"],
facecolor="#ffffff")

@check_figures_equal()
def test_scatter_color_none(self, fig_test, fig_ref):
ax_test = fig_test.subplots()
ax_test.scatter([1], [1], facecolor='red', edgecolor='none')
ax_test.scatter([2], [2], facecolor='none', edgecolor='blue')

ax_ref = fig_ref.subplots()
ax_ref.scatter([1], [1], facecolor='red', edgecolor=(0, 0, 0, 0))
ax_ref.scatter([2], [2], facecolor=(0, 0, 0, 0), edgecolor='blue')


def _params(c=None, xsize=2, *, edgecolors=None, **kwargs):
return (c, edgecolors, kwargs, xsize)
Expand Down
Loading