Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix edgecolor in catplot with kind='bar' #3547

Merged
merged 2 commits into from
Nov 4, 2023
Merged
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 seaborn/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -2830,7 +2830,11 @@ def catplot(
if saturation < 1:
color = desaturate(color, saturation)

edgecolor = p._complement_color(kwargs.pop("edgecolor", default), color, p._hue_map)
if kind in ["strip", "swarm"]:
kwargs = _normalize_kwargs(kwargs, mpl.collections.PathCollection)
kwargs["edgecolor"] = p._complement_color(
kwargs.pop("edgecolor", default), color, p._hue_map
)

width = kwargs.pop("width", 0.8)
dodge = kwargs.pop("dodge", False if kind in undodged_kinds else "auto")
Expand All @@ -2841,7 +2845,6 @@ def catplot(

jitter = kwargs.pop("jitter", True)
plot_kws = kwargs.copy()
plot_kws["edgecolor"] = edgecolor
plot_kws.setdefault("zorder", 3)
plot_kws.setdefault("linewidth", 0)
if "s" not in plot_kws:
Expand All @@ -2858,7 +2861,6 @@ def catplot(

warn_thresh = kwargs.pop("warn_thresh", .05)
plot_kws = kwargs.copy()
plot_kws["edgecolor"] = edgecolor
plot_kws.setdefault("zorder", 3)
if "s" not in plot_kws:
plot_kws["s"] = plot_kws.pop("size", 5) ** 2
Expand Down
2 changes: 1 addition & 1 deletion tests/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -2307,7 +2307,7 @@ def test_err_kws(self, fill):
dict(data="long", x="a", y="y", errorbar=("pi", 50)),
dict(data="long", x="a", y="y", errorbar=None),
dict(data="long", x="a", y="y", capsize=.3, err_kws=dict(c="k")),
dict(data="long", x="a", y="y", color="blue", ec="green", alpha=.5),
dict(data="long", x="a", y="y", color="blue", edgecolor="green", alpha=.5),
]
)
def test_vs_catplot(self, long_df, wide_df, null_df, flat_series, kwargs):
Expand Down
Loading