Questions tagged [violin-plot]

A violin plot is a method of plotting numeric data. It is a box plot with a rotated kernel density plot on each side.

A violin plot is a method of plotting numeric data. It is a box plot with a rotated kernel density plot on each side.

https://en.wikipedia.org/wiki/Violin_plot

364 questions
3
votes
1 answer

Issues with seaborn.catplot

I am a beginner in Python (using Python 3.7 in Spyder 3.3.2 and Anaconda Navigator 1.9.6). I have no problem creating seaborn violin plots, but the moment I try to Facetgrid them I run into issues. I tried using catplot. Here is my violin plot code…
arm
  • 31
  • 1
  • 2
3
votes
1 answer

How To Create a Matplotlib Violin Plot

I'm trying to get my first Matplotlib violin plot going and I'm using the exact code from this SO post but getting a KeyError error. I have no idea what that means. Any ideas? Process pandas dataframe into violinplot import pandas as pd import…
sisdog
  • 2,649
  • 2
  • 29
  • 49
3
votes
0 answers

Weighted violinplot

I have a Pandas dataframe of data on generator plant capacity (MW) by fuel type. I wanted to show the estimated distribution of plant capacity in two different ways: by plant (easy) and by MW (harder). Here's an example: # import libraries import…
Emily Beth
  • 709
  • 1
  • 7
  • 23
3
votes
1 answer

Pairing Scatter Points with Lines Across Fill Condition of Violin Plot

Here is a data.frame with three subjects in a 2 by 2 design: x<-data.frame("sub" = rep(c("sub1","sub2","sub3"),times=4), "cond1" = rep(c("A","B"),times=c(6,6)), "cond2" = rep(c("C","C","C","D","D","D"),times=2), "score"…
Manoj Doss
  • 33
  • 3
3
votes
1 answer

How do I show Y value of highest density point on a violin plot with ggplot2?

Let's take the dataset from docs' example for ggplot2 violin graphs, > ToothGrowth$dose <- as.factor(ToothGrowth$dose) > head(ToothGrowth) len supp dose 1 4.2 VC 0.5 2 11.5 VC 0.5 3 7.3 VC 0.5 4 5.8 VC 0.5 5 6.4 VC 0.5 6 10.0 …
mlemboy
  • 95
  • 2
  • 6
3
votes
1 answer

Ignore outliers in ggplot2 geom_violin

Is there a way to ignore outliers in geom_violin and have the y axis plot be correlated with the Q1 and Q3 quantiles? (range=1.5 in base R). It would be great if this could be automated (i.e. not just calling out a specific y axis limit). I see a…
kslayerr
  • 819
  • 1
  • 11
  • 21
3
votes
1 answer

What is the correct way to create a violin plot that has one violin split by hue?

What is the correct way to create a violin plot that has one violin split by hue? I've tried different approaches and it seems that the only way is to create a feature that shares the same value for every entry in the dataset. And pass that…
Ilya Chernov
  • 411
  • 7
  • 18
3
votes
1 answer

geom_violin - "Error in grid.Call.graphics(C_lines, x$x, x$y, index, x$arrow) : invalid hex digit in 'color' or 'lty'"

I've tried to find a solution to my problem but I couldn't. I want to plot geom_violin with draw_quantiles c(0.25, .50, .75), but it returns this error: "Error in grid.Call.graphics(C_lines, x$x, x$y, index, x$arrow) : invalid hex digit in…
David_Rowie
  • 127
  • 2
  • 10
3
votes
1 answer

Problems adding `sample sizes` to ggplot violinplot legend

I have the following ggplot2 violinplot library(ggplot2) …
ShanZhengYang
  • 16,511
  • 49
  • 132
  • 234
3
votes
2 answers

Violin Plot in R using ggplot2 on multiple data columns

I am new to R, and trying to make violin plots of species count data for various species at each sampling depth. The data looks like the following Depth Cd Cf Cl 1 3.6576 0 2 0 2 4.0000 2 13 0 3 4.2672 0 0 0 4 13.1064 0 2 0 5…
Alexander
  • 33
  • 1
  • 3
3
votes
1 answer

Python: weighted violinplots

I have to work with weighted probability distributions quite a bit and would like to use violinplots for some visualization. However I can not find a way to create these with weighted data in any of the usual suspects (matplotlib, seaborn, bokeh,…
sllrp
  • 33
  • 6
3
votes
1 answer

Create a violin plot where the violin and boxplot are of different colours in ggplot2

I am trying to create a grouped violin plot (see figure), where I am plotting 3 levels for four categorical variables. The plot comes out fine given the data other than the fact that the boxes are the same colour as the wider violin plots behind…
Craig
  • 35
  • 1
  • 5
3
votes
1 answer

Fill transparency with geom_violin

How can increase the alpha of the fill of violin plots but not the alpha of the boundary line? Changing alpha as an argument to geom_violin() results in both the fill and line changing.
saladi
  • 3,103
  • 6
  • 36
  • 61
3
votes
1 answer

Combined box-violin plot not aligned

I want to graph a distribution along two dimensions using a violinplot with a boxplot in it. The result can be really fascinating, but only when done right. ToothGrowth$dose <- as.factor(ToothGrowth$dose) head(ToothGrowth) plot <-…
MERose
  • 4,048
  • 7
  • 53
  • 79
2
votes
1 answer

Plotting a swarmplot on a violinplot changes the ylim and truncates the violins

import seaborn as sns import numpy as np # for sample data import pandas as pd # sample data np.random.seed(365) rows = 60 data1 = {'Type 1': ['a'] * rows, 'Total': np.random.normal(loc=25, scale=3, size=rows)} data2 = {'Type 1': ['b'] *…