violin-plot

Overlay scatterpoints on split violin plot with ggplot2

不羁岁月 提交于 2019-12-11 05:34:12
问题 I followed this nice answer to generate split violin plots in a 2x2 design Now imagine that these data come from repeated measures in different subjects. I'd like to, additionally, plot the individual data in a scatterplot (I know the plot might end up being too busy, I'd like to see it first). I'm almost there, but have a small error that's probably easily fixed. I include a whole working example in case there's a better way to do this. This first part I copied directly from the previous

Plot only one side/half of the violin plot

拥有回忆 提交于 2019-12-11 02:24:35
问题 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, data.frame(val = rnorm(n = 50, mean = 0 - offset), group = i) ) } dframe$group = as.factor(dframe$group) ggplot(data = dframe, aes(x = group, y = val)) + geom_violin() produces a plot like this I though would like to have one looking like this: Ideally, the

Process pandas dataframe into violinplot

ぃ、小莉子 提交于 2019-12-10 04:15:19
问题 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 S1 -20.778094 2 S1 -20.027689 3 S1 -19.747170 4 S1 -20.814405 5 S1 -21.955406 6 S1 -23.018960 ... 12258 S6 -34.089906 12259 S6 -34.222814 12260 S6 -26.712010 12261 S6 -24.555973 12262 S6 -23.062616 12263 S6 -20.488411 I want to create a violinplot that has a different violin

Differing quantiles: Boxplot vs. Violinplot

浪子不回头ぞ 提交于 2019-12-07 02:49:22
问题 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 ='errorbar', width = 0.1)+ geom_boxplot(width = 0.2)+ facet_grid(. ~ Species, scales = "free_x") + xlab("") + ylab (expression(paste("Value"))) + coord_cartesian(ylim = c(3.5,9.5)) + scale_y_continuous(breaks = seq(4, 9, 1)) + theme(axis.text.x=element_blank(), axis.text.y =

Differing quantiles: Boxplot vs. Violinplot

吃可爱长大的小学妹 提交于 2019-12-05 06:41:58
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 ='errorbar', width = 0.1)+ geom_boxplot(width = 0.2)+ facet_grid(. ~ Species, scales = "free_x") + xlab("") + ylab (expression(paste("Value"))) + coord_cartesian(ylim = c(3.5,9.5)) + scale_y_continuous(breaks = seq(4, 9, 1)) + theme(axis.text.x=element_blank(), axis.text.y = element_text(size = rel(1.5)), axis.ticks.x = element_blank(), strip.background=element_rect(fill="black"),

Process pandas dataframe into violinplot

别来无恙 提交于 2019-12-05 06:03:24
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 S1 -20.778094 2 S1 -20.027689 3 S1 -19.747170 4 S1 -20.814405 5 S1 -21.955406 6 S1 -23.018960 ... 12258 S6 -34.089906 12259 S6 -34.222814 12260 S6 -26.712010 12261 S6 -24.555973 12262 S6 -23.062616 12263 S6 -20.488411 I want to create a violinplot that has a different violin for each of the six scenarios. I'm new to Pandas and dataframes, and despite much research/testing

How to show whiskers and points on violin plots?

痞子三分冷 提交于 2019-12-01 19:34:32
问题 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 19.42866012 Sample5 A 19.70386922 Sample6 A 16.22906914 Sample7 A 12.48966785 Sample8 B 15.53280377 Sample9 A 9.345795955 Sample10 B 9.196524783 Sample11 B 9.196524783 Sample12 B 9.196524783 Sample13 A 9.434355615 Sample14 A 15.27604692 Sample15 A 18.90867329 Sample16 B 11

How to show whiskers and points on violin plots?

故事扮演 提交于 2019-12-01 18:34:30
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 19.42866012 Sample5 A 19.70386922 Sample6 A 16.22906914 Sample7 A 12.48966785 Sample8 B 15.53280377 Sample9 A 9.345795955 Sample10 B 9.196524783 Sample11 B 9.196524783 Sample12 B 9.196524783 Sample13 A 9.434355615 Sample14 A 15.27604692 Sample15 A 18.90867329 Sample16 B 11.71503095 Sample17 B 13.7632545 Sample18 A 9.793864295 Sample19 B 9.196524783 Sample20 A 14.52562066

Changing the color of matplotlib's violin plots

允我心安 提交于 2019-11-28 10:48:55
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 documentation . Any ideas or hacks to color the violins differently? matplotlib.pyplot.violinplot() says it returns: A dictionary mapping each component of the violinplot to a list of the corresponding collection instances created. The dictionary has the following keys: bodies : A list of the matplotlib.collections.PolyCollection instances

Changing the color of matplotlib's violin plots

心已入冬 提交于 2019-11-27 03:49:39
问题 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 documentation. Any ideas or hacks to color the violins differently? 回答1: matplotlib.pyplot.violinplot() says it returns: A dictionary mapping each component of the violinplot to a list of the corresponding collection instances created. The