Week 11 : Violin Plot

Hi… I am not getting vertical violin plot though I mentioned orient argument as v. Here dataset p denotes penguins data from seaborn library. I am attaching screenshot of the code and output. Please help me to get vertical violin plot.

Did you read the warning?

/usr/local/lib/python3.7/dist-packages/seaborn/_core.py:1319: UserWarning: Vertical orientation ignored with only `x` specified.

Looks you need specify other axis as well.

sns.violinplot(x=“bill_depth_mm”, y=“body_mass_g”, orient=“v”, data=pg)

But following plot not giving much meaning

<matplotlib.axes._subplots.AxesSubplot at 0x7fd127dace10>

<matplotlib.axes._subplots.AxesSubplot at 0x7fd1277a5990>

The orient parameter doesn’t work well with single variables. It requires both X & Y to be specified with conditions that if there is vertical plot, then the y axis need to be a numeric and in horizontal orientation, x axis need to be numeric. Instead of specifying orient, you can directly specify the y-axis to get a vertical violin plot:


The question here is how is it then working in the lecture? If there any settings that the professor is using?