search for: geom_boxplot

Displaying 20 results from an estimated 101 matches for "geom_boxplot".

2012 Jul 01
4
geom_boxplot
Also, it is possible to change "ylim" also? 2012/7/1 li li <hannah.hlx@gmail.com> > Dear all, > I have a few questions regarding the boxplot output from the > "geom_boxplot" function. > Attached is the output I get. Below are my questions: > > 1. How can I define the xlab and ylab myself? > Also I would like to remove "factor(variable)" > line on the right side. > > 2. How can I define the colors of the boxplots myself. > F...
2012 Jul 02
5
ggplot: dodge positions
...boxplots (grouped by two factors) and I want to overlay the original observations and the following code does almost what I want: library(ggplot) ddf <- data.frame(x=factor(rep(LETTERS[1:4], each=30)), y = runif(120,0,10), grp = factor(rep(rep(1:3, 10), 4))) ggplot(ddf, aes(x, y, colour=grp)) + geom_boxplot() + geom_point() Yet the position of the points and the position of the boxes on the x-axis is not the same. I would like that the points are shifted accordingly, such that they line up with the boxplots. I tried position_dodge: ggplot(ddf, aes(x, y, colour=grp)) + geom_boxplot() + geom_point(aes...
2011 Aug 10
1
Sequential Naming of ggplot .pngs using plyr
...t;-1 for(i in c('a','b','c','d')){ png(file=paste('/tmp/plot_number_',ctr,'.png',sep=''),height=8.5, width=11,units='in',pointsize=9,res=300) print(ggplot(dat[,names(dat) %in% c('site',i)],aes(x=factor(site),y=dat[,i]))+geom_boxplot()+opts(title=paste('plot number',ctr,sep=' '))) dev.off() ctr<-ctr+1 } Is there a way to do the same naming using plyr (or data.table or foreach which I am not familiar with at all!)? m.dat<-melt(dat,id.vars='site') ddply(m.dat,.(variable),function(df) print(...
2008 May 27
1
label outliers in geom_boxplot (ggplot2)
...and Hadley, I would like to have a boxplot with ggplot2 and have the outlier values labelled with their "name" attribute. So I did > library(ggplot2) > dat=data.frame(num=rep(1,20), val=c(runif(18),3,3.5), name=letters[1:20]) > p=ggplot(dat, aes(y=val, x=num))+geom_boxplot(outlier.size=4, outlier.colour="green") > p+geom_text(label=dat$name) But this -of course- labels all the data points. So I searched high and low to find the way to only label the outliers, but I couldn't find any solution. Probably my keywords were inappropriate, but I loo...
2010 Mar 10
2
ggplot2: "varwidth"-equivalent for geom_boxplot?
Hi, Is there such a thing? If no: is it easily simulated? thanks, Joh
2015 Jun 16
4
Ayuda boxplot ggplot2
...stren la misma escala en el eje Y, es decir, que las dos lleguen a 60? Adjunto el boxplot y a continuación el código que usé para producirlo. vplayout <- function(x, y) viewport(layout.pos.row = x, layout.pos.col = y) tor<-ggplot(parasitos, aes(x=Arrenurus, y = torax, fill= Arrenurus)) + geom_boxplot(binwidth = 2) + scale_fill_manual(values = c("lightgreen", "lightblue"))+ ylab("Total parásitos")+ xlab("")+ ggtitle("Parásitos en el tórax") abd<- ggplot(parasitos, aes(x=Arrenurus, y = abdomen, fill= Arrenurus)) + geom_boxplot(binwidth =...
2007 Aug 08
1
Help using gPath
....text.312, label.text.314) xaxis.gTree.340:: ticks.segments.309 labels.gTree.315:: (label.text.312, label.text.314) strip.gTree.364:: (background.rect.361, label.text.363) strip.gTree.370:: (background.rect.367, label.text.369) guide.rect.357 guide.rect.358 boxplots.gTree.283:: geom_boxplot.gTree.273:: (GRID.segments.267, GRID.segments.268, geom_bar.rect.270, geom_bar.rect.272) geom_boxplot.gTree.281:: (GRID.segments.275, GRID.segments.276, geom_bar.rect.278, geom_bar.rect.280) boxplots.gTree.301:: geom_boxplot.gTree.291:: (GRID.segments.285, GRID.segments.286, geom_bar.rect.2...
2011 Jan 25
2
ggplot geom_boxplot and stat_smooth
...ot;, "nealrut", "stan", "vlakan"), class = "factor")), .Names = c("konc.f", "bel", "typ"), row.names = c(NA, -102L), class = "data.frame") > Here is what I did p<-ggplot(ad, aes(x=konc.f, y=bel, colour=typ)) p+geom_boxplot()+geom_jitter(position=position_jitter(w=0.1))+stat_smooth() geom_smooth: Only one unique x value each group.Maybe you want aes(group = 1)? I get nice picture with boxes but I expected to get something like smoothing line through box centres. Is it possible without some hack to stat_smooth cod...
2011 Jun 08
3
How to suppress factor labels
...rplot: pp = qplot(time, error, data=times, size=I(1), geom="jitter", main=title, ylab="Error (min)", xlab="Time before ON (min)", alpha=I(1/10), color=times$runway, ylim=c(-30,40)) pp2 = pp + with(times, facet_wrap(~ runway, ncol=2)) print(pp2 + geom_boxplot(alpha=.5, color="blue", outlier.colour="green", outlier.size=1)) The x variable is a factor for every minute from 0:60. My problem is that ggplot2 labels every factor value on the x axis, and they overlap. How can I make ggplot2 label only, say every 5th factor value on the x ax...
2013 Oct 12
2
Order of factors with facets in ggplot2
..."), 100, replace= T) f2 <- gl(4, 25, labels = paste("M", 1:4, sep="")) x <- runif(100) df <- data.frame(f1, f2, x) #df <- df[order(df[,1]), ] df <- ddply(df, ~ f1 + f2, transform, Avg_x = mean(x)) myplot <- ggplot(df, aes(x=reorder(f2, Avg_x), x)) + geom_boxplot() + facet_wrap(~ f1, scale = "free", ncol = 1) + stat_summary(fun.y=mean, geom="point", col = "red") myplot Thanks in advance for any help! Lars. [[alternative HTML version deleted]]
2010 Jul 07
2
Boxplots from data.frame
...L1 1234 1 1234 1 1235 1 ... 1255 1 2335 2 3444 2 ... 10001 50 12311 50 ... The first column is my x value, the second is my y. I'd like to produce one boxplot for each point on the graph, 50 in total (for this case). When I try something like: p <- ggplot(meltl, aes(L1, value)) p + geom_boxplot() I get one giant boxplot, which tells me nothing much. Can anyone give me a helping hand? -- Ian Bentley M.Sc. Candidate Queen's University Kingston, Ontario [[alternative HTML version deleted]]
2010 Nov 29
2
drop levels problem
...- c("year","fatPerc") ? # Year variable is a factor with three levels ?# Subset to plot only 'first' year firstyear <- subset(xmelt,year=='first');str(firstyear) #?Plot showing three levels still after I?made the subset ??ggplot(firstyear,aes(year,fatPerc)) + geom_boxplot() + geom_jitter() # Try to drop the levels but dropUnusedLevels() doesn't seem to work here ? dropUnusedLevels() ggplot(firstyear,aes(year,fatPerc)) + geom_boxplot() + geom_jitter() # code below also should drop levels but it doesn't #data.frame(lapply(firstyear, function(x) if (is.factor...
2024 Aug 16
2
boxplot notch
Thanks Ben, Here the reproducible example. It works without notch=TRUE, but provides an error with notch=TURE Error in `geom_boxplot()`: ! Problem while converting geom to grob. ? Error occurred in the 1st layer. Caused by error in `ans[ypos] <- rep(yes, length.out = len)[ypos]`: ! replacement has length zero Run `rlang::last_trace()` to see where the error occurred. Warning message: In rep(yes, length.out = len) : 'x'...
2009 Jan 07
1
Problem with ggplot2 - facet_wrap and boxplot
...rnorm(50), rnorm(50, 1)), x2 = c(rnorm(50), rnorm(50, 1.5)), x3 = c(rnorm(50, 0.5), rnorm(50, 2.5)), group = as.factor(rep(c("a", "b"), each = 50))) df.melt <- melt(df, id = c("id", "group")) head(df.melt) p <- ggplot(df.melt, aes(variable, value)) p + geom_boxplot(aes(fill = group)) # This graph is great, but I would like to have two panels, one for group 'a', and one for group 'b' # With this code, I can't have one boxplot for each variable x1, x2 and x3 p + geom_boxplot(aes(fill = group)) + facet_wrap(~group) # but it's working with...
2024 Aug 16
1
boxplot notch
I don't see anything obviously wrong here. There may be something subtle, but we probably won't be able to help without a reproducible example ... On 2024-08-16 9:24 a.m., SIBYLLE ST?CKLI via R-help wrote: > Dear community > > > > I tried the following code using geom_boxplot() and notch=TRUE. Does anyone > know if the command ?notch=TRUE? is at the wrong place in my special code > construct? > > > > Without notch=TRUE the code provides the planned ggplot. > > > > Kind regards > > Sibylle > > > > Code: >...
2018 Mar 12
2
ggplot and boxplots
...272 Disabled 684.92 35 272 Disabled 687.87 36 272 Disabled 687.33 37 272 Enabled 696.22 38 272 Enabled 700.61 39 272 Enabled 695.2 40 272 Enabled 697.46 41 272 Enabled 696.83 ... This command for some reason, fails to generate a boxplot > ggplot(testing_ggplot,aes(factor(V2),V3))+geom_boxplot() +facet_wrap(~as.factor(V1)) I don't seem to figure out what is wrong with the ggplot command I'm using. I attached a png with the generated plot thanks, yh -------------- next part -------------- A non-text attachment was scrubbed... Name: ggplot.png Type: image/png Size: 62358 bytes D...
2024 Aug 16
1
boxplot notch
Dear community I tried the following code using geom_boxplot() and notch=TRUE. Does anyone know if the command ?notch=TRUE? is at the wrong place in my special code construct? Without notch=TRUE the code provides the planned ggplot. Kind regards Sibylle Code: MS1<- MS %>% filter(QI_A!="NA") %>% droplevels() MS1$Jahr<-a...
2010 Dec 17
1
ggplot missing fill colours in boxplot legend
...e legend the fill colour for Day 1 and Day 2 is left blank. Instead the little boxes next to the labels (Day 1, Day 2) are both unfilled (white). The boxplots are filled properly, but without the fill colour in the legend its difficult decipher the plot p=ggplot(CorbulaMR3,aes(factor(Site),VO2)) p+geom_boxplot(aes(fill=factor(Day)))+scale_fill_manual('Day', breaks = c('Day 1', 'Day 2'), + values = c('grey','black'), + labels = c('Day 1', 'Day 2'))+xlab('Sampling Site')+ylab('Metabolic Rate')+opts(title="Sampling")...
2008 Apr 04
0
ggplot2 - version 0.6
...useful information * the legend code is now considerably more sophisticated and will attempt to merge together legends for the same variable * also, legends are drawn based on the geoms used (instead of the scales used, as previously) so should match the plot much better (e.g. for geom_smooth, geom_boxplot, geom_vline, geom_abline, geom_pointrange). These features are new, so there are likely to be a few bugs that I haven't discovered. Please me know if you do find any. Other additions and corrections * coord_equal: should now work correctly in all situations * coord_polar: add start and...
2008 Apr 04
0
ggplot2 - version 0.6
...useful information * the legend code is now considerably more sophisticated and will attempt to merge together legends for the same variable * also, legends are drawn based on the geoms used (instead of the scales used, as previously) so should match the plot much better (e.g. for geom_smooth, geom_boxplot, geom_vline, geom_abline, geom_pointrange). These features are new, so there are likely to be a few bugs that I haven't discovered. Please me know if you do find any. Other additions and corrections * coord_equal: should now work correctly in all situations * coord_polar: add start and...