boxplot

Is it possible to plot a boxplot from previously-calculated statistics easily (in R?) [duplicate]

佐手、 提交于 2019-11-28 13:29:18
Possible Duplicate: Draw bloxplots in R given 25,50,75 percentiles and min and max values I have a number of sets of summary statistics from various datasets: max, min, mean, median etc. I'd like to plot box-plots of these - or at least, similar plots to boxplots (I don't have UQ and LQ stats, although it may be possible to get those). I don't have the original data, so I can't just use the boxplot function in R. Is there an easy way to do this in R when you just have the summary statistics? If not, is there an easy way to do this using another free tool? The boxplot function in R uses a low

How to put values on a boxplot for median, 1st quartile and last quartile?

五迷三道 提交于 2019-11-28 12:49:03
How to put values on boxplot and control its width? X<-c(1,2,,3,4,4,5,5,6,6,6,6,6,7) I need to write values for min, max, 1st quartile, median and last quartile. How can I put it there? You can use horizontal = TRUE get a horizontal boxplot and axes = FALSE to remove the axes. staplewex = 1 sets the staple width the same as the box width Then you can use fivenum to return the statistics used to create the boxplot and use these as text labels, fiddling with the y value until you have what you want boxplot(X, horizontal = TRUE, axes = FALSE, staplewex = 1) text(x=fivenum(X), labels =fivenum(X),

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

与世无争的帅哥 提交于 2019-11-28 12:46:03
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 actually plotted. The format above is a tab separated table. Thanks GSee This post shows how you can do this with bxp which is the function that boxplot uses, but you

ggplot - Add regression line on a boxplot with binned (non-continuous) x-axis

老子叫甜甜 提交于 2019-11-28 12:38:58
问题 I have a dataset with this structure: df<- data.frame (VPD.mean=rnorm(100,mean=2,sd=0.8), treatment=c("ambient","elevated"), variable=rnorm(100,mean=50,sd=10)) df$group <- with(df, as.factor (ifelse (VPD.mean>0 & VPD.mean<=1,"0-1",ifelse ( VPD.mean>1 & VPD.mean<=1.5,"1-1.5",ifelse ( VPD.mean >1.5 & VPD.mean<2, "1.5-2",ifelse ( VPD.mean >=2 & VPD.mean<2.5, "2-2.5",ifelse ( VPD.mean >=2.5 & VPD.mean <3,"2.5-3", ifelse( VPD.mean >=3,">3", NA) ))))))) df$group<- factor(df$group,levels=c("0-1","1

R ggplot2 boxplot - varying box width by a function/vector values

孤者浪人 提交于 2019-11-28 12:10:46
问题 I have a data frame with several groups values, and I would like to have a boxplot per category (drawn together). I want to have each boxplot with a different width, based not on the rows count per category, but on a column sum. For example, with the following data.frame: Data <- data.frame(roadType = sample(c("Ramp", "Primary Street", "Highway"),100,replace=TRUE), drivesCount = sample(1:100,100,replace=TRUE), happyPercentage=sample(c(0,0.25,0.5,0.75,1),100,replace=TRUE)) I know there's a way

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

ggplot2: horizontal position of stat_summary with geom_boxplot

[亡魂溺海] 提交于 2019-11-28 11:36:14
I want to annotate mean of each boxplot using ggplot2 . However, I could not figure out how to horizontally center the symbols marking the means within their respective boxes (see image below). MWE is below for reference: library(ggplot2) ggplot(data=mpg, mapping=aes(x=class, y=hwy)) + geom_boxplot(aes(color = drv), outlier.shape = NA) + stat_summary(fun.y = mean, geom = "point", size=2, aes(shape = drv, color = drv)) + theme_bw() Try with position_dodge() ggplot(data=mpg, mapping=aes(x=class, y=hwy)) + geom_boxplot(aes(color = drv), outlier.shape = NA) + stat_summary(fun.y = mean, geom =

annotate boxplot in ggplot2

青春壹個敷衍的年華 提交于 2019-11-28 11:27:37
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. The most succinct way I can think of is to use stat_summary . I've also mapped the labels to a color aesthetic, but you can, of course, set the labels to a single color if you wish: ggplot(mtcars, aes(x=factor(cyl), y=mpg,

R: Plot multiple box plots using columns from data frame

∥☆過路亽.° 提交于 2019-11-28 11:02:12
I would like to plot an INDIVIDUAL box plot for each unrelated column in a data frame. I thought I was on the right track with boxplot.matrix from the sfsmsic package, but it seems to do the same as boxplot(as.matrix(plotdata) which is to plot everything in a shared boxplot with a shared scale on the axis. I want (say) 5 individual plots. I could do this by hand like: par(mfrow=c(2,2)) boxplot(data$var1 boxplot(data$var2) boxplot(data$var3) boxplot(data$var4) But there must be a way to use the data frame columns? EDIT: I used iterations, see my answer. You could use the reshape package to

How to add data to BoxPlot in WFA?

馋奶兔 提交于 2019-11-28 10:55:18
问题 I'm creating manually a boxplot chart. I have 4 double[] arrays with some calculations results that i want show on chart. I don't know how to connect correctly my arrays with chart Series. Here is my chart: Chart chart = new Chart(); chart.Series.Add("S1"); chart.Series.Add("S2"); chart.Series.Add("S3"); chart.Series.Add("S4"); chart.ChartAreas.Add("ChartArea1"); chart.ChartAreas[0].Visible = true; chart.ChartAreas[0].Position.Auto = true; chart.Series[0].ChartType = SeriesChartType.BoxPlot;