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
8
votes
2 answers

Is it possible to annotate a seaborn violin plot with number of observations in each group?

I would like to annotate my violin plot with the number of observations in each group. So the question is essentially the same as this one, except: python instead of R, seaborn instead of ggplot, and violin plots instead of boxplots Lets take…
posdef
  • 6,498
  • 11
  • 46
  • 94
7
votes
2 answers

How to center align the plot over the xticks when offset by hue

My boxplot seem not align with the x-tick of the plot. How to make the boxplot align with the x-tick? import pandas as pd import seaborn as sns import matplotlib.pyplot as plt df = pd.DataFrame([['0', 0.3],['1', 0.5],['2', 0.9], …
lemon93
  • 159
  • 1
  • 8
7
votes
2 answers

Cannot make seaborn violin plot horizontal [Python3.X]

Using Seaborn, I can create a . Making it vertical is no problem. But I would like to have a horizontal violin plot. I saw that it is advised to just switch x and y when passing parameters in the violinplot function. I am looking to get the same…
splinter
  • 3,727
  • 8
  • 37
  • 82
6
votes
1 answer

How to assign different position for each group in a violinplot

The shape of violin plot is useful for visualizing data distribution of grouped data. The size of each group can also be visualized as the area of the 'violin'. But when the data is heterogeneous, the width of certain group is too small to show any…
Chang Ye
  • 1,105
  • 1
  • 12
  • 25
6
votes
3 answers

Restrain scattered jitter points within a violin plot by ggplot2

A following is used to generate the violin plot in ggplot2 : ggplot(violin,aes(x=variable,y=log(value+0.5),color=Group)) + geom_violin(scale="width") + geom_jitter(aes(group=Group), position=position_jitterdodge()) + …
akh22
  • 661
  • 4
  • 16
6
votes
1 answer

Violin plot: How is the adjacent value range determined, and why is it different from boxplot?

In theory the violinplot of vioplot package is a boxplot + density function. In the "boxplot part", the black box corresponds to the IQR (indeed, see below), and the midline should correspond to the same range (adjacent values, default 1.5 IQR),…
bud.dugong
  • 689
  • 7
  • 16
5
votes
1 answer

Shaded violin plot by group

I'm trying to produce a variation of a grouped violin plot in R (preferably using ggplot2), similar to the one below: which was produced by the following reproducible example code: # Load libraries # library(tidyverse) # Create dummy data…
Constantinos
  • 1,327
  • 7
  • 17
5
votes
1 answer

Force plotly violin plot not to display a violin on zero values

I have measurements from several groups which I would like to plot as violin plots: set.seed(1) df <- data.frame(val = c(runif(100,1,5),runif(100,1,5),rep(0,100)), group = c(rep("A",100),rep("B",100),rep("C",100))) Using R's…
dan
  • 6,048
  • 10
  • 57
  • 125
5
votes
1 answer

How to show whiskers and points on violin plots?

I have a dataframe df with the following data. I want to plot the logCPM expression of the gene between two groups A and B. Samples Type GeneA Sample1 B 14.82995162 Sample2 B 12.90512275 Sample3 B 9.196524783 Sample4 A …
beginner
  • 1,059
  • 8
  • 23
5
votes
2 answers

Separate halves of split violinplot to compare tail data

Is there a way to physically separate the two halves of a "split" seaborn violinplot (or other type of violinplot)? I'm trying to compare two different treatments, but there is a skinny tail, and it's difficult (impossible) to tell whether one or…
Emily Beth
  • 709
  • 1
  • 7
  • 23
5
votes
1 answer

For geom_violin, how is the total area of all violins specified?

In a call to geom_violin within ggplot2, you can specify that the area of each violin should be proportional to the number of observations making up that violin by specifying scale="count". I assume this operates internally by taking some total…
Bajcz
  • 433
  • 5
  • 20
5
votes
1 answer

inaccurate range of violin plots in seaborn

For some reasons, the range of the plot is not accurate. In my data there are no negative values. When I set range to -100 to 100 there some portion of the distribution under 0 mark.
5
votes
1 answer

matplotlib - violinplot ValueError with empty lists

I am getting the following ValueError when I try to plot a "violin plot" with matplotlib. ValueError: zero-size array to reduction operation minimum which has no identity axes[0].violinplot([[1,2,3],[],[2,3,4]]) I hope two violin plots to be…
Han
  • 625
  • 2
  • 7
  • 25
4
votes
1 answer

R geom_violin + geom_boxplot legend issues

I'm running into probably a rare situation where I have values for several groups that I'd like to plot using R's ggplot2's geom_violin + geom_boxplot, filling and coloring the violins by group, and coloring the boxes by group as well. Occasionally,…
dan
  • 6,048
  • 10
  • 57
  • 125
4
votes
1 answer

To highlight one point in Violin chart PlotlyJS

I am using Violin chart of PlotylyJS library, and it takes an array of elements and plots it on the chart. Is possible if I want to highlight one point with a different color from that array? Like if my array is demoViolin = [31.8, 63.5, 65, 59,…
Salomi Edward
  • 533
  • 4
  • 15
1
2
3
24 25