boxplot

NA's are being plotted in boxplot ggplot2

青春壹個敷衍的年華 提交于 2019-12-03 23:24:09
I'm trying to plot a v. simple boxplot in ggplot2. I have species richness vs. landuse class. However, I have 2 NA's in my data. For some strange reason, they're being plotted, even when they're being understood as NA's by R. Any suggestion to remove them? The code I'm using is: ggplot(data, aes(x=luse, y=rich))+ geom_boxplot(mapping = NULL, data = NULL, stat = "boxplot", position = "dodge", outlier.colour = "red", outlier.shape = 16, outlier.size = 2, notch = F, notchwidth = 0.5)+ scale_x_discrete("luse", drop=T)+ geom_smooth(method="loess",aes(group=1)) However, the graph includes 2 NA's for

Labeling outliers on boxplot in R

Deadly 提交于 2019-12-03 16:12:04
I would like to plot each column of a matrix as a boxplot and then label the outliers in each boxplot as the row name they belong to in the matrix. To use an example: vv=matrix(c(1,2,3,4,8,15,30),nrow=7,ncol=4,byrow=F) rownames(vv)=c("one","two","three","four","five","six","seven") boxplot(vv) I would like to label the outlier in each plot (in this case 30) as the row name it belongs to, so in this case 30 belongs to row 7. Is there an easy way to do this? I have seen similar questions to this asked but none seemed to have worked the way I want it to. 42- In the example given it's a bit boring

Get Quantile values from geom_boxplot()

寵の児 提交于 2019-12-03 16:07:04
I'm using ggplot2 function geom_boxplot() to create boxplots of my data. Similarly to this question, I'd like to get the quantile values used for the creation of the boxplot, e.g., in a matrix. Is there a way to print out the values used within geom_boxplot()? Probably the easiest way is to use an outside of ggplot aggregate, but here's how to do it with ggplot , using the function ggplot_build on a created plot: library(ggplot2) p <- ggplot(mtcars, aes(x=factor(gear), y=mpg)) + geom_boxplot() ggplot_build(p)$data [[1]] ymin lower middle upper ymax outliers notchupper notchlower x PANEL group

Colorfill boxplot in R-cran with lines, dots, or similar

醉酒当歌 提交于 2019-12-03 16:04:18
I need to use black and white color for my boxplots in R. I would like to colorfill the boxplot with lines and dots. For an example: I imagine ggplot2 could do that but I can't find any way to do it. Thank you in advance for your help! I think it is hard to do this with ggplot2 since it dont use shading polygon(gris limitatipn). But you can use shading line feature in base plot, paramtered by density and angle arguments in some plot functions ( ploygon, barplot,..). The problem that boxplot don't use this feature. So I hack it , or rather I hack bxp internally used by boxplot. The hack consist

Plotting several groups of box plots side-by-side in R

旧街凉风 提交于 2019-12-03 12:29:48
问题 I am trying to plot two box-plots in the same plot, each within the same category. I can generate the boxplots individually, but am stumped when I try to get them onto the same graph. Here is what I have so far: a<-matrix(nrow=100,ncol=3,data=runif(300,max=2)) b<-matrix(nrow=100,ncol=3,data=runif(300,max=1)) colnames(a)<-c("case 1","case 2","case 3") colnames(b)<-c("case 1","case 2","case 3") boxplot(cbind(a,b)) This plot results in 6 boxplots, first 3 for a, then 3 for b. Is there a trick

Time-series boxplot in pandas

浪子不回头ぞ 提交于 2019-12-03 12:12:24
How can I create a boxplot for a pandas time-series where I have a box for each day? Sample dataset of hourly data where one box should consist of 24 values: import pandas as pd n = 480 ts = pd.Series(randn(n), index=pd.date_range(start="2014-02-01", periods=n, freq="H")) ts.plot() I am aware that I could make an extra column for the day, but I would like to have proper x-axis labeling and x-limit functionality (like in ts.plot() ), so being able to work with the datetime index would be great. There is a similar question for R/ggplot2 here , if it helps to clarify what I want. Rutger Kassies

How to create one box plot using multiple columns and argument “split”

放肆的年华 提交于 2019-12-03 09:01:21
I need create a box plot from a data.frame with three numeric columns , and use the argument split to separate the boxes by paint . I have a large data.frame, but what I need is in the example below: paint<-c("blue", "black", "red", "blue", "black", "red", "blue", "black", "red") car1<-c(100, 138, 123, 143, 112, 144, 343, 112, 334) car2<-c(111, 238, 323, 541, 328, 363, 411, 238, 313) car3<-c(432, 123, 322, 342, 323, 522, 334, 311, 452) data<-data.frame(paint, car1, car2, car3) >data paint car1 car2 car3 1 blue 100 111 432 2 black 138 238 123 3 red 123 323 322 4 blue 143 541 342 5 black 112 328

grouped boxplot r ggplot2

懵懂的女人 提交于 2019-12-03 08:56:07
I have 5 columns of numerical data (Equipment, Hyiene.items etc) and 1 column of categorical data (A or D). I'd like to make a grouped boxplot of the numerical data grouped by category but I cannot find a way: head(sc) Equipment Hygiene.items Patient Near.bed Far.bed Care 1 0 0 1 5 1 D 2 1 4 1 2 0 D 3 3 1 1 2 0 D 4 0 2 2 3 1 A 5 1 2 1 5 2 A 6 1 2 1 1 1 A boxplot(sc~sc$Care) would seem like the most appropriate way right? I like ggplot2 but it doesn't look like i can simply do this: ggplot(sc, aes(y=sc)) + geom_boxplot(aes(fill=Care)) EDIT: What I like the look of: I think what I'm after is

Adding Different Percentiles in boxplots in R

元气小坏坏 提交于 2019-12-03 08:19:16
I am failry new to R and recently used it to make some Boxplots. I also added the mean and standard deviation in my boxplot. I was wondering if i could add some kind of tick mark or circle in different percentile as well. Let's say if i want to mark the 85th, $ 90th percentile in each HOUR boxplot, is there a way to do this? My data consist of a year worth of loads in MW in each hour & My output consist of 24 boxplots for each hour for each month. I am doing each month at a time because i am not sure if there is a way to run all 96(Each month, weekday/weekend , for 4 different zones) boxplots

Displaying separate means within fill groups in ggplot boxplot

主宰稳场 提交于 2019-12-03 08:09:14
I have a grouped boxplot using data with 3 categories. One category is set as the x-axis of the boxplots, the other is set as the fill, and the last one, as a faceting category. I want to display the means for each fill group, but using stat_summary only gives me the mean for the x-axis category, without separating the means for the fill: Here is the current code: demoplot<-ggplot(demo,aes(x=variable,y=value)) demoplot+geom_boxplot(aes(fill=category2),position=position_dodge(.9))+ stat_summary(fun.y=mean, colour="black", geom="point", shape=18, size=4,) + facet_wrap(~category1) Is there any