search for: geom_boxplot

Displaying 20 results from an estimated 93 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...
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...
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...
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...
2008 Feb 27
1
ggplot2 boxplot confusion
...ity plot help and noticed the reference to ..density.. as a means to pass density data instead of original data. But I can't seem to get a boxplot to overlay a density plot. This is what I've got so far with consequent error message: m <- ggplot(mydata, aes(x=VALUE)) m + geom_density()+ geom_boxplot(aes(x=..density..)) Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 0, 180 I've tried y=..density.., both x= and y = ..density.. and neither and all fail somehow. Problem is I don't really understand what I'm doing at this point. So can a...
2013 May 11
3
boxplot with grouped variables
my dataset looked like this in the beginning: >Daten V1 V2 V3 1 Dosis Gewicht Geschlecht 2 0 6.62 m 3 0 6.65 m 4 0 5.78 m 5 0 5.63 m I need box plots for V2 with all combination of V1 and V3, so I deleted the first row, and tried this: boxplot(Daten$V2[Daten$V3=="m"]) but it does not work and I
2011 Mar 17
1
ggplot, transformation, and ylim
...ther. Due to the nature of the y-values, I wish to scale the y axis with a log base two transformation. Furthermore, I wish to plot the two sets of y-values as boxplots in separate graphs with the same ylim (and thus with the same ticks and tick labels). As of now, I have: ggplot(data, aes(x1, y1))+geom_boxplot()+scale_y_log2() ggplot(data, aes(x2, y2))+geom_boxplot()+scale_y_log2() which successfully creates the boxplot and transforms the y-axis. However, I can't figure out how to change the range of the y-axis so that they're the same in both graphs. Inserting "+scale_y_continuous(limits=c(...