-1

Who do know why the splitted parts aren't joined?

enter image description here

sns.violinplot(x = "good", y = "fixed acidity", hue = "good", data = df, palette="muted", split=True, inner = "quartile", bw=.2)
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
Mike B.
  • 1
  • 1

1 Answers1

0

I also struggled with this issue but just figured this out. The reason is because you have two categories (0 and 1) under the the "good" attribute, and this would result in the x axis having two x-ticks (0 and 1).

Imagine a bar plot, the diagram would have two bars, one at x-tick 0 and the other at x-tick 1 and both would never be touching each other. To solve this, we would need to only have one x-tick.

what you would need to do is to create a dummy column with a single value, then set the x axis as the dummy so that the x axis would have one x-tick.

df["dummy"] = "0" #have used 0 integer and the plot did not come out right

sns.violinplot(x = "dummy", y = "fixed acidity", hue = "good", data = df,\
palette="muted", split=True, inner = "quartile", bw=.2)
jy o
  • 1
  • 1