boxplot

ggplot2 - Multiple Boxplots from Sources of Different Lengths

梦想与她 提交于 2021-02-07 06:25:22
问题 I have a few different vectors of varying length for which I would like to generate side by side boxplots using ggplot2. This is relatively straight forward to do with the Base plotting system. However ggplot2 only takes a single data frame as input, which is difficult to create from data of varying lengths. a <- rnorm(10) b <- rnorm(100) c <- rnorm(1000) boxplot(a, b, c) Q: What is the correct way to draw boxplots using ggplot2 using data of varying lengths? 回答1: ggplot uses tidy long data

How to get indices of outliers in a dataframe boxplot?

拈花ヽ惹草 提交于 2021-02-05 09:59:26
问题 I have a dataframe and I want to get each columns of outliers indices. Here is part of my dataframe; mediamarkt[,48] [1] 7126 4012 3711 3237 3432 2671 2861 7065 3158 4023 4770 3861 [13] 4108 7408 9071 3596 3889 4093 4446 6059 8345 10291 5546 5129 [25] 4683 4670 5694 8619 11047 5743 5775 5216 5283 4854 7871 9944 [37] 3797 3821 3834 3999 4577 8898 11396 4508 5459 3668 3885 4021 [49] 7491 8831 3513 3606 3332 3189 3656 6859 9167 3306 3305 3379 [61] 3507 3912 6562 8245 3420 3445 3530 3404 3847

Grouped Boxplots

Deadly 提交于 2021-02-05 08:21:25
问题 I have data frame and I want to plot grouped boxplots. Here is part of the data. a <- c(0, 100, 250, 500, 750, 0, 100, 250, 500, 750, 0, 100, 250, 500, 750) b <- c(2.646, 3.756, 26.270, 30.997, 39.294, 2.646, 3.756, 26.270, 30.997, 39.294, 16.363, 25.950, 38.913,45.000, 47.698) c <- c(0.0, 0.5, 0.1, 5.8, 21.9, 0.0, 0.5, 0.1, 5.8, 21.9, 9.7. 12.5, 25.1, 29.3, 31.9) d <- c(14.7, 15.0, 13.8, 18.4, 28.2, 14.7, 15.0, 13.8, 18.4, 28.2, 23.6, 24.0, 25.7, 29.0, 33.1) I merged the vectors to get a

Add P values to comparisons within groups boxplot

[亡魂溺海] 提交于 2021-02-05 07:56:50
问题 I'm trying to create a boxplot which shows only the significant p values, within the groups for each bar in a box plot. For example here it would compare I1 and SI2 for the "fair", "good", "very good" etc I've tried using the following code to achieve the above plot library(ggplot2) library(dplyr) data("diamonds") labeldat <- diamonds %>% group_by(cut, clarity) %>% dplyr::summarise(labels = paste(n(), n_distinct(color), sep = "\n")) Comparisons = list(c("I1","SI2"),c("I1","SI1"),c("I1","VS2")

Weird lines appearing in the R graph

我的梦境 提交于 2021-02-05 04:59:37
问题 Journal in which I am submitting a research paper requires that article should be submitted in PDF-format. I am using R for statistics and graphs. I have used basic formulas to print my graphs. barplot() for bar charts, boxplot() for boxplots and draw.triple.venn in VennDiagram package. I am not using special commands or formulas for device or graphical parameters. I print my graphs in R and then copied them "as metafile" to produce high quality graphs. When i attach these graphs in R they

Weird lines appearing in the R graph

这一生的挚爱 提交于 2021-02-05 04:59:32
问题 Journal in which I am submitting a research paper requires that article should be submitted in PDF-format. I am using R for statistics and graphs. I have used basic formulas to print my graphs. barplot() for bar charts, boxplot() for boxplots and draw.triple.venn in VennDiagram package. I am not using special commands or formulas for device or graphical parameters. I print my graphs in R and then copied them "as metafile" to produce high quality graphs. When i attach these graphs in R they

Weird lines appearing in the R graph

ε祈祈猫儿з 提交于 2021-02-05 04:59:22
问题 Journal in which I am submitting a research paper requires that article should be submitted in PDF-format. I am using R for statistics and graphs. I have used basic formulas to print my graphs. barplot() for bar charts, boxplot() for boxplots and draw.triple.venn in VennDiagram package. I am not using special commands or formulas for device or graphical parameters. I print my graphs in R and then copied them "as metafile" to produce high quality graphs. When i attach these graphs in R they

Grouped boxplot in R

主宰稳场 提交于 2021-01-29 20:56:36
问题 df <- data.frame(values = c(2.5,12,4.8,56,78),samples = c('45fe.K2','59ji.K2','59rc.K1','45hi.K1','96hu.K1'),group = c('K2','K2','K1','K1','K1')) df values samples group 1 2.5 45fe.K2 K2 2 12.0 59ji.K2 K2 3 4.8 59rc.K1 K1 4 56.0 45hi.K1 K1 5 78.0 96hu.K1 K1 I want to generate a group grouped boxplot. So I want one plot with a K1 and K2 boxplot. I thought this https://www.r-graph-gallery.com/265-grouped-boxplot-with-ggplot2.html would do it but I can´t figure out how p1 <- ggplot(df, aes(x

Grouped boxplot in R

▼魔方 西西 提交于 2021-01-29 18:38:00
问题 df <- data.frame(values = c(2.5,12,4.8,56,78),samples = c('45fe.K2','59ji.K2','59rc.K1','45hi.K1','96hu.K1'),group = c('K2','K2','K1','K1','K1')) df values samples group 1 2.5 45fe.K2 K2 2 12.0 59ji.K2 K2 3 4.8 59rc.K1 K1 4 56.0 45hi.K1 K1 5 78.0 96hu.K1 K1 I want to generate a group grouped boxplot. So I want one plot with a K1 and K2 boxplot. I thought this https://www.r-graph-gallery.com/265-grouped-boxplot-with-ggplot2.html would do it but I can´t figure out how p1 <- ggplot(df, aes(x

ggplot2: create a box and whiskers plot with individual observations

流过昼夜 提交于 2021-01-29 10:45:34
问题 I am having problems to plot the individual observations. These are my data: Subject Part Face_type Microvolts 1 First Half AF -2.029166667 2 First Half AF -1.76 3 First Half AF -3.788333333 4 First Half AF -2.691666667 5 First Half AF 0.335833333 6 First Half AF -4.719166667 7 First Half AF -0.920833333 8 First Half AF -1.719166667 9 First Half AF -6.115 10 First Half AF -0.4175 11 First Half AF -0.855833333 12 First Half AF 0.1925 13 First Half AF -1.485833333 14 First Half AF -1.9475 15