diff --git a/seaborn/_marks/base.py b/seaborn/_marks/base.py index 324d0221e7..8c064f5998 100644 --- a/seaborn/_marks/base.py +++ b/seaborn/_marks/base.py @@ -12,6 +12,7 @@ from pandas import DataFrame from matplotlib.artist import Artist +from seaborn._compat import MarkerStyle from seaborn._core.scales import Scale from seaborn._core.properties import ( PROPERTIES, @@ -182,6 +183,8 @@ def _resolve( if return_array: feature = np.asarray(feature) + if name == "marker": + feature = [MarkerStyle(f) for f in feature] return feature if feature.depend is not None: diff --git a/tests/_marks/test_dot.py b/tests/_marks/test_dot.py index 49b5e8f129..d09717bb18 100644 --- a/tests/_marks/test_dot.py +++ b/tests/_marks/test_dot.py @@ -4,7 +4,7 @@ from numpy.testing import assert_array_equal from seaborn.palettes import color_palette -from seaborn._core.plot import Plot +from seaborn._core.plot import Plot, Plotter from seaborn._marks.dot import Dot, Dots @@ -53,15 +53,16 @@ def test_filled_unfilled_mix(self): mark = Dot(edgecolor="w", stroke=2, edgewidth=1) p = Plot(x=x, y=y).add(mark, marker=marker).scale(marker=shapes).plot() - ax = p._figure.axes[0] - points, = ax.collections - C0, *_ = p._theme["axes.prop_cycle"].by_key()["color"] - self.check_offsets(points, x, y) - self.check_colors("face", points, [C0, to_rgba(C0, 0)], None) - self.check_colors("edge", points, ["w", C0], 1) + self._test_filled_unfilled_mix(x, y, p, mark) - expected = [mark.edgewidth, mark.stroke] - assert_array_equal(points.get_linewidths(), expected) + def test_identity_marker(self): + x = [1, 2] + y = [4, 5] + shapes = ["o", "x"] + + mark = Dot(edgecolor="w", stroke=2, edgewidth=1) + p = Plot(x=x, y=y).add(mark, marker=shapes).scale(marker=None).plot() + self._test_filled_unfilled_mix(x, y, p, mark) def test_missing_coordinate_data(self): @@ -85,6 +86,17 @@ def test_missing_semantic_data(self, prop): points, = ax.collections self.check_offsets(points, [1, 3], [5, 4]) + def _test_filled_unfilled_mix(self, x, y, p: Plotter, mark: Dot): + ax = p._figure.axes[0] + points, = ax.collections + C0, *_ = p._theme["axes.prop_cycle"].by_key()["color"] + self.check_offsets(points, x, y) + self.check_colors("face", points, [C0, to_rgba(C0, 0)], None) + self.check_colors("edge", points, ["w", C0], 1) + + expected = [mark.edgewidth, mark.stroke] + assert_array_equal(points.get_linewidths(), expected) + class TestDots(DotBase):