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

Update seaborn.categorical.py to allow adjusting the marker colors of the box plot within a violin plots #3597

Open
Cortexan opened this issue Dec 21, 2023 · 0 comments

Comments

@Cortexan
Copy link

Cortexan commented Dec 21, 2023

In the current version, it is not possible to manually set the marker colours for the inner box plot appearing within a violin plot via passing "markerfacecolor" or "markeredgecolor" to "inner_kws" as key-value pairs.

this is because the "dot_kws" parameters "markerfacecolor" and "markeredgecolor" are directly set to "w" when the violin plot is generated:

`

on lines 1139-1148 of categorical.py:

            dot_kws = {
                "marker": marker,
                "markersize": box_width / 1.2,
                "markeredgewidth": box_width / 5,
                "transform": trans,
                **inner_kws,
                "markeredgecolor": "w",
                "markerfacecolor": "w",
                "color": linecolor,  # simplify tests
            }

`

this is resolved by removing the explicit colour settings from dot_kws, resulting in a marker that defaults to all white if no parameters are passed, but adopts manual settings when they are:

`

replace lines 1139-1148 of categorical.py with:

            dot_kws = {
                "marker": marker,
                "markersize": box_width / 1.2,
                "markeredgewidth": box_width / 5,
                "transform": trans,
                **inner_kws,
                "color": linecolor,  # simplify tests
            }

`

to reproduce the error and more desirable functionality, pass the following inner_kws parameter to a violin plot, once before and once after the modification to categorical.py described above:

inner_kws=dict(box_width=3, whis_width=1, color=".5", marker="o", markerfacecolor="k", markeredgecolor="#ff20ff", solid_capstyle="round"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant