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
0
votes
1 answer

Why the new column created in violin plot which is not in the dataset and one which is the one disappeared?

I generated a Violin plot and used the code: df1 <- df %>% mutate(Model=factor(Model,levels=c("SVM", "Grid_SVM", "MARS", "Grid_Mars", "RF", "Grid_RF"))) # to arrange the variable as per the user wish ggplot(df1, aes(x = Model, y = RE)) + …
0
votes
1 answer

Violin plot of ggplot2 is not in order as in dataset on x-axis

I created the using below code, But on the x-axis, Models name are not in order as in the data set (i.e. "Observed", "SVM", "Grid_SVM", "MARS", "Grid_Mars", "RF", "Grid_RF"). Where the edit is required in the code? ggplot(df1, aes(x = Model, y =…
0
votes
1 answer

Two overlapping violinplots, trying to add colors and legen manually

Hello I'm trying to plot two violinplots one on another. I found useful posts here and I prepared the following code: nums <- c(rep(1,12),rep(2,32),rep(3,19)) type <- rep('violin_green',63) df1 <- data.frame(nums=nums,type=type) nums <-…
Adamm
  • 2,150
  • 22
  • 30
0
votes
1 answer

is there a way to change the color of seaborn violin_plot

Following is my code: import seaborn as sns df = sns.load_dataset('iris') The following line gives me a normal violin plot of species vs sepal_length: sns.violinplot(x = df['species'], y = df['sepal_length']) The output looks as such Now, I need…
Sufyan Parkar
  • 171
  • 3
  • 9
0
votes
1 answer

Is there a function to allow the assignment of numeric values to characters?

So, the issue is as follows: I have a dataset which contains A Condition factor variable with (for this example) 3 levels that need to be plotted on a y axis, A Group factor variable with three levels to be plotted on the x, and A value for each…
0
votes
1 answer

How to add single values (shapes) to geom_split_violin() based on groups?

I would like to add single reference values to each of my half violins. It should look something like this with a shape: Here is the code for my current plot (first img): ggplot(data = csi, aes(x=species,y=CSI, fill=time))+ …
retam611
  • 23
  • 7
0
votes
1 answer

Violin Plots by Year

I am not having any luck with geom_violin in ggplot today. Any help? I have 10 years worth of running times in a local race. I want to plot the spread of only the top 10 times for each year. Ex: 2018: 14:51-17:29, 2017: 15:03-18:22 etc …
0
votes
1 answer

Separating violinplots in seaborn with a line

I'm trying to plot multi-hue distributions with Seaborn, but I find that the plots are difficult to be traced back to the tick they belong to. I have tried to add a grid, but the grid is only showing on the dimension of the distribution, so…
gandreadis
  • 3,004
  • 2
  • 26
  • 38
0
votes
1 answer

Removing stat_summary symbols from legend categories in ggplot2

I have the following code that has created two violin plots: ggplot(both,aes(x=levelsname,y=loginc,fill=levelsname))+ geom_violin() + stat_summary(fun.y = mean, aes(shape="Mean"), colour='black', …
geoscience123
  • 164
  • 1
  • 11
0
votes
0 answers

Discrepancy between draw_quantiles in geom_violin and stat_summary in ggplot2

I am attempting to plot a simple violin plot with the added quantiles (0.25,0.5,0.75). I use two methods here, draw_quantiles within geom_violin (straight line) and stat_summary (red points). Is there a reason why the line and points appear to be…
Andrew Hamel
  • 336
  • 1
  • 13
0
votes
1 answer

Change the y limits ( especially the minimum) with Vlnplot

I would like to draw a violin plot from my single cell data. I am using this function : Vlnplot(object, features, cols = NULL, pt.size = 0.1) But I would like to change the y axis to 3000-10000 instead of 0-70000. They only propose to change the y…
0
votes
1 answer

violin plot in R studio

First, I read in the bodyfat.csv data file and generate a variable "bodycat" to categorize body fat into the three categories athlete, average, or obese. (Athlete, less than 14%, Average, 14-25%, Obese, greater than 25%) bodycat <-…
Leo
  • 93
  • 2
  • 11
0
votes
2 answers

Plotly Violin Plot Add Trace cannot add names

the example code from the website: import plotly.graph_objects as go from plotly.colors import n_colors import numpy as np np.random.seed(1) # 12 sets of normal distributed random data, with increasing mean and standard deviation data =…
Jim R
  • 1
  • 2
0
votes
1 answer

D3.js violin plot not showing up

Sorry in advance, I am very new to javascript. I am trying to use this code https://www.d3-graph-gallery.com/graph/violin_basicDens.html with my own data.
dfahsjdahfsudaf
  • 461
  • 4
  • 11
0
votes
1 answer

Create barplot in R with gradient based on density

I want to represent the density of a number of variables as you would in a boxplot, violin plot, or beeswarm. But in this case, each variable would be a band with the density displayed as a gradient along the bar. Hopefully I don't need to manually…
abalter
  • 9,663
  • 17
  • 90
  • 145