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
63
votes
4 answers

Split violin plot with ggplot2

I'd like to create a split violin density plot using ggplot, like the fourth example on this page of the seaborn documentation. Here is some data: set.seed(20160229) my_data = data.frame( y=c(rnorm(1000), rnorm(1000, 0.5), rnorm(1000, 1),…
user102162
  • 822
  • 1
  • 8
  • 9
32
votes
3 answers

Changing the color of matplotlib's violin plots

Is there a way to change the color of the violin plots in matplotlib? The default color is this "brownish" color, which is not too bad, but I'd like to color e.g., the first 3 violins differently to highlight them. I don't find any parameter in the…
user2489252
25
votes
1 answer

Align violin plots with dodged box plots

I have this data frame set.seed(1234) x <- rnorm(80, 5, 1) df <- data.frame(groups = c(rep("group1",20), rep("group2",20), rep("group3",20), rep("group4",20)), …
Sergio.pv
  • 1,380
  • 4
  • 14
  • 23
17
votes
1 answer

How to better fit seaborn violinplots

The following code gives me a very nice violinplot (and boxplot within). import numpy as np import seaborn as sns import matplotlib.pyplot as plt foo = np.random.rand(100) sns.violinplot(foo) plt.boxplot(foo) plt.show() So far so good. However,…
n1000
  • 5,058
  • 10
  • 37
  • 65
15
votes
2 answers

Process pandas dataframe into a violinplot

I have data I'm reading from an Excel spreadsheet. The data has a number of observations for each of six scenarios, S1 to S6. When I read in the data to my dataframe df, it looks as follows: Scenario LMP 0 S1 -21.454544 1 …
Emily Beth
  • 709
  • 1
  • 7
  • 23
14
votes
2 answers

Seaborn violinplot transparency

I would like to have increasingly transparent violins in a seaborn.violinplot. I tried the following: import seaborn as sns tips = sns.load_dataset("tips") ax = sns.violinplot(x="day", y="total_bill", data=tips, color='r', alpha=[0.8, 0.6, 0.4,…
pr94
  • 1,263
  • 12
  • 24
13
votes
3 answers

Multiple Columns for HUE parameter in Seaborn violinplot

I am working with tips data set, and here is the head of data set. total_bill tip sex smoker day time size 0 16.99 1.01 Female No Sun Dinner 2 1 10.34 1.66 Male No Sun Dinner 3 2 21.01 3.50 Male No Sun…
Ahmad Anis
  • 2,322
  • 4
  • 25
  • 54
11
votes
1 answer

Quartiles line properties in seaborn violinplot

trying to figure out how to modify the line properties (color, thickness, style etc) of the quartiles in a seaborn violinplot. Example code from their website: import seaborn as sns sns.set(style="whitegrid") tips = sns.load_dataset("tips") ax =…
Red Sparrow
  • 387
  • 1
  • 5
  • 17
11
votes
2 answers

Differing quantiles: Boxplot vs. Violinplot

require(ggplot2) require(cowplot) d = iris ggplot2::ggplot(d, aes(factor(0), Sepal.Length)) + geom_violin(fill="black", alpha=0.2, draw_quantiles = c(0.25, 0.5, 0.75) , colour = "red", size = 1.5) + stat_boxplot(geom…
pat-s
  • 5,992
  • 1
  • 32
  • 60
10
votes
2 answers

Violin Plot troubles in Python on log scale

My violin plots are showing weird formats when using a log scale on my plots. I've tried using matplotlib and seaborn and I get very similar results. import matplotlib.pyplot as plt import seaborn as sns data = [[1e-05, 0.00102, 0.00498, 0.09154,…
Stephen Wyka
  • 313
  • 2
  • 10
10
votes
0 answers

seaborn violinplot out of valid range

I am using seaborn to create violin plots. Right now I am creating violin plots out of proportion values (so all values are between 0 and 1), but the resulting violin plot is quite off. Its bottom ranges into negative values and its top ranges into…
Niema Moshiri
  • 909
  • 5
  • 14
9
votes
2 answers

ggplot2: How to get dots to group with violin plots?

I would like to plot violin plots where x axis is exon however I want to group the plots. This works if its just violins however when I add in the jitters for some reason its not responding the correct aes and is plotting on its own? Here is a…
Ahdee
  • 4,679
  • 4
  • 34
  • 58
9
votes
3 answers

How to plot two violin plot series on the same graph using seaborn?

Looking at the documentation about violon plots with seaborn, I would like to know how to plot two series of violin plots on the same axis (point 1) and that they are comparable (point 2). About point 1, I would like to reproduce that plot for each…
Ger
  • 9,076
  • 10
  • 37
  • 48
8
votes
1 answer

Violin plot for positive values with python

I find violin plots very informative and useful, I use python library 'seaborn'. However, when applied to positive values, they nearly always show negative values at the lower end. I find this really misleading, especially when working with…
lanenok
  • 2,699
  • 17
  • 24
8
votes
2 answers

Plot only one side/half of the violin plot

I would like to have only one half of violin plots (similar to the plots created by stat_density_ridges from ggridges). A MWE library(ggplot2) dframe = data.frame(val = c(), group = c()) for(i in 1:5){ offset = i - 3 dframe = rbind(dframe, …
Exocom
  • 791
  • 2
  • 8
  • 24
1
2 3
24 25