ggpubr

Lay out multiple ggplot graphs on a page

落花浮王杯 提交于 2020-01-16 09:51:30
问题 I generate a list of ggplot objects inside a loop as follows: myPlots = list() for(i in 1:length(maturities)){ myPlots[[i]] <- ggplot(deltaIR.df, aes(sample = deltaIR.df[,i])) + stat_qq() + stat_qq_line() + labs(title=maturities[i], x = "Theoretical (Normal)", y = "Empirical Distribution") } Depending on the dataset, there could be between 4 and 10 plots in myPlots. I now want to print them on one page in two rows, and have tried various methods with varying degrees of success. The most

Use dataframe variable names in plot titles

旧街凉风 提交于 2019-12-29 09:28:27
问题 I have a dataframe with several variables that I wish to label and then use in several ggplots. I have applied labels using the labeller package with the following code. library(tidyverse) library(labeller) library(ggpubr) example.df <- data.frame( origin = sample(c("hum_1", "mou_1"), 100, replace = TRUE), v1 = rnorm(100, 100, 5), v2 = rnorm(100, 10,5), v3 = rnorm (100, 25, 5)) example.df <- example.df %>% set_variable_labels(origin = "original sample", v1 = "effect of Rx", v2 = "response",

R ggplot2 boxplots - ggpubr stat_compare_means not working properly

落爺英雄遲暮 提交于 2019-12-28 16:13:28
问题 I am trying to add significance levels to my boxplots in the form of asterisks using ggplot2 and the ggpubr package, but I have many comparisons and I only want to show the significant ones. I try to use the option hide.ns=TRUE in stat_compare_means , but it clearly does not work , it might be a bug in the ggpubr package. Besides, you see that I leave out group "PGMC4" from the pairwise wilcox.test comparisons; how can I leave this group out also for the kruskal.test ? The last question I

add mean value on boxplot with ggpubr

怎甘沉沦 提交于 2019-12-13 03:03:18
问题 I'm trying to add a label on boxplot using ggpubr package. Here's the code I used: library(ggplot2) library(ggpubr) compare_means(len ~ supp, data = ToothGrowth, method="t.test", paired=TRUE, group.by = "dose") # Box plot facetted by "dose" p1 <- ggboxplot(ToothGrowth, x = "supp", y = "len", xlab=F, color = "supp", palette = "jco", facet.by = "dose", add="mean", short.panel.labs = FALSE) # Use only p as label. p2 <- p1 + stat_compare_means(method = "t.test", paired = T, label = "p") p2 And

how can I add multiple pvalues to ggplot grouped boxplot

浪尽此生 提交于 2019-12-11 04:13:45
问题 I have boxplot and I would like to add pvalues for 4 comparisons across two factors. Here is the data set: dput(CauloQ_datMannot) structure(list(V1 = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L), .Label = c("B", "BF", "BFi ", "Bi"), class = "factor"), variable = structure(c(1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L), .Label = c("V2", "V3", "V4"), class = "factor"), value = c(0.00051, 0.00055, 0.00056, 0.00074, 0.00079, 0.00083, 0.00093, 0.00082, 0.00073, 0.0011, 0.00113, 0

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

Use dataframe variable names in plot titles

左心房为你撑大大i 提交于 2019-11-29 16:47:30
I have a dataframe with several variables that I wish to label and then use in several ggplots. I have applied labels using the labeller package with the following code. library(tidyverse) library(labeller) library(ggpubr) example.df <- data.frame( origin = sample(c("hum_1", "mou_1"), 100, replace = TRUE), v1 = rnorm(100, 100, 5), v2 = rnorm(100, 10,5), v3 = rnorm (100, 25, 5)) example.df <- example.df %>% set_variable_labels(origin = "original sample", v1 = "effect of Rx", v2 = "response", v3 = "weight (kg)") This gets the labels to show up in the dataframe. However, when I use ggqqplot from

R ggplot2 boxplots - ggpubr stat_compare_means not working properly

两盒软妹~` 提交于 2019-11-28 11:40:52
I am trying to add significance levels to my boxplots in the form of asterisks using ggplot2 and the ggpubr package, but I have many comparisons and I only want to show the significant ones. I try to use the option hide.ns=TRUE in stat_compare_means , but it clearly does not work , it might be a bug in the ggpubr package. Besides, you see that I leave out group "PGMC4" from the pairwise wilcox.test comparisons; how can I leave this group out also for the kruskal.test ? The last question I have is how the significance level works? As in * is significant below 0.05, ** below 0.025, *** below 0