boxplot

Draw bloxplots in R given 25,50,75 percentiles and min and max values [duplicate]

社会主义新天地 提交于 2019-12-17 20:26:55
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: geom_boxplot with precomputed values I have a table where each row is a different sample and each column is the name, minimum, maximum, mean, 25th percentile, 50th percentile, 75th percentile respectively. Here is a sample. sample1 1 38 10 8 10 13 sample2 1 39 10 9 11 14 sample3 2 36 11 10 10 13 I would like to know how I can use the data in this format in order to plot boxplots since that is the data that is

Tukeys post-hoc on ggplot boxplot

心已入冬 提交于 2019-12-17 20:01:49
问题 Ok, so I think I'm pretty close with this, but I'm getting an error when I try to construct my box plot at the end. My goal is to place letters denoting statistical relationships among the time points above each boxplot. I've seen two discussion of this on this site, and can reproduce the results from their code, but can't apply it to my dataset. Packages library(ggplot2) library(multcompView) library(plyr) Here is my data: dput(WaterConDryMass) structure(list(ChillTime = structure(c(1L, 1L,

annotate boxplot in ggplot2

爱⌒轻易说出口 提交于 2019-12-17 19:44:05
问题 I've created a side-by-side boxplot using ggplot2. p <- ggplot(mtcars, aes(x=factor(cyl), y=mpg)) p + geom_boxplot(aes(fill=factor(cyl))) I want to annotate with min, max, 1st quartile, median and 3rd quartile in the plot. I know geom_text() can do so and may be fivenum() is useful. But I cannot figure out how exactly I can do!. These values should be displayed in my plot. 回答1: The most succinct way I can think of is to use stat_summary . I've also mapped the labels to a color aesthetic, but

ggplot: arranging boxplots of multiple y-variables for each group of a continuous x

时光毁灭记忆、已成空白 提交于 2019-12-17 17:38:44
问题 I would like to create boxplots of multiple variables for groups of a continuous x-variable. The boxplots should be arranged next to each other for each group of x. The data looks like this: require (ggplot2) require (plyr) library(reshape2) set.seed(1234) x <- rnorm(100) y.1 <- rnorm(100) y.2 <- rnorm(100) y.3 <- rnorm(100) y.4 <- rnorm(100) df <- as.data.frame(cbind(x,y.1,y.2,y.3,y.4)) which I then melted dfmelt <- melt(df, measure.vars=2:5) The facet_wrap as shown in this solution (

Joining means on a boxplot with a line (ggplot2)

China☆狼群 提交于 2019-12-17 17:32:11
问题 I have a boxplot showing multiple boxes. I want to connect the mean for each box together with a line. The boxplot does not display the mean by default, instead the middle line only indicates the median. I tried ggplot(data, aes(x=xData, y=yData, group=g)) + geom_boxplot() + stat_summary(fun.y=mean, geom="line") This does not work. Interestingly enough, doing stat_summary(fun.y=mean, geom="point") draws the median point in each box. Why would "line" not work? Something like this but using

lower and upper quartiles in boxplot in R

不想你离开。 提交于 2019-12-17 16:45:38
问题 I have X=c(20 ,18, 34, 45, 30, 51, 63, 52, 29, 36, 27, 24) With boxplot , i'm trying to plot the quantile(X,0.25) and quantile(X,0.75) but this is not realy the same lower and upper quartiles in boxplot in R boxplot(X) abline(h=quantile(X,0.25),col="red",lty=2) abline(h=quantile(X,0.75),col="red",lty=2) Do you know why? 回答1: The values of the box are called hinges and may coincide with the quartiles (as calculated by quantile(x, c(0.25, .075)) ), but are calculated differently. From ?boxplot

How to plot a hybrid boxplot: half boxplot with jitter points on the other half?

时光怂恿深爱的人放手 提交于 2019-12-17 06:45:12
问题 I'm trying to make a similar plot to Fig. 2d-f in an article published on Nature this year. It's basically a half boxplot with points on the other half. Can anyone give me some hints? Thank you very much! These are my data and code which produced full boxes with points inside require(magrittr) require(tidyverse) dat <- structure(list(p1 = c(0.0854261831077604, 0.408418657218253, 0.577793646477315, 0.578028229977424, 0.48933166218204, 0.53117814324334, 0.526653494462464, 0.00687616283435221, 0

How to customize notches in ggplot boxplot [closed]

风格不统一 提交于 2019-12-13 20:31:23
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I had a question on how to change/customize the upper and lower limit of a notch on a boxplot created by ggplot2. I looked through the function stat_boxplot and found that ggplot calculates the notch limits with the equation median +/- 1.58 * iqr / sqrt(n). However instead of that equation I wanted to change it

How to boxplot row-wise matrix in R?

夙愿已清 提交于 2019-12-13 19:24:39
问题 I have a matrix with 8 columns. For each row I'd like to a plot a single boxplot. I prefer the boxplots to be in a single plot. So the following example should produce 4 boxplots (8 values each) - all in a single image. Data example: > data[2:5,] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,] 0.6 0.5 0.5357143 0.5357143 0.5357143 0.5357143 0.5357143 0.5185185 [2,] 0.5 0.5 0.5357143 2.5357143 0.5357143 0.5357143 0.5357143 0.5185185 [3,] 0.5 0.7 0.5357143 0.5357143 0.5357143 0.5357143 0.5357143 0

How to make an horizontal box-and-whiskers plot in gnuplot

时间秒杀一切 提交于 2019-12-13 17:06:42
问题 How do you make an horizontal box-and-whiskers plot in gnuplot? Similarly to this one: Gnuplot can easily be used to produce vertical box-and-whiskers plots with the 'candlesticks' and 'whiskerbars' keywords, but I have not managed to find any example of an horizontal candlesticks/box-and-whiskers horizontal plot produced via gnuplot online. Example of a vertical plot produced by gnuplot: example of a vertical box-and-whiskers plot http://www.cise.ufl.edu/~dts/cop3530/proj02/candlesticks.6