search for: position_dodge

Displaying 20 results from an estimated 43 matches for "position_dodge".

2011 Dec 04
1
Polishing my geom_bar for publication
...y-axis (species name) on the right figure to avoid duplication, and (3) fix the width, such that both figures have the same apparence regardless of the legend. Thank you very much in advance! The code is as follow: (a<-ggplot(Final2, aes(x=spp, y=CPUE, fill=season)) + geom_bar(position=position_dodge()) + geom_errorbar(aes(ymin=CPUE-cpue.se, ymax=CPUE+cpue.se), size=.3, width=.2, position=position_dodge(.9)) + xlab("Species") + scale_x_discrete(breaks=c("100","102","107","88",&quo...
2013 Mar 07
3
ggpliot2: reordering of factors in facets facet.grid(). Reordering of factor on x-axis no problem.
...levels=c("F", "E", "C", "D", "A", "B"), order=T) # plotting: ggplot(Summ, aes(factor3, mean, group = factor1, ymin = mean - sdv , ymax = mean + sdv)) + geom_point(position = position_dodge(width = 0.25), size = 3) + geom_line(position = position_dodge(width = 0.25)) + geom_errorbar(width = 0.3, position = position_dodge(width = 0.25), size = 0.3) + facet_wrap(~Grouping, ncol = 2) + theme(strip.background = element_blank()) + scale_shape(solid = FALSE)+ theme_bw() + yla...
2012 Jul 02
5
ggplot: dodge positions
...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(ymax=max(y)), position = position_dodge(width=.75)) but that did not really help, as all points are now dodged and I just want to have a fixed offset for each subgroup of points such that the boxplot and the points are aligned....
2013 Feb 03
1
ggplot2 plotting errorbars.
Hi, i'm using this lines of code: dodge <-position_dodge(width=0.9) ggplot(dfm,aes(x = X,y = value)) + geom_bar(aes(fill = variable), position=dodge, stat="identity") + geom_errorbar(aes(ymin=value-er, ymax=value+er),width=0.25, position=dodge,stat="identity") to plot this data frame X variable value er 1...
2010 Mar 12
1
simple plot in ggplot2, wrong error bars
...factor(c("veget", "fruit", "veget", "fruit")), se = c(0.01, 0.01, 0.02, 0.026)) limits <- aes(ymax = coon + se, ymin=coon - se) p<-ggplot(df, aes(fill=group, y=coon, x=trt)) p+geom_bar(position="dodge",stat="identity") dodge <- position_dodge(width=0.9) > p + geom_bar(position="dodge") + geom_errorbar(limits, position="dodge", > width=0.5) as you noticed the code above gets the error bars in the wrong columns. So I used the code below (I replaced position_dodge w/ a negative value and geom_errorbarr with dodg...
2011 Jan 25
2
ggplot geom_boxplot and stat_smooth
Dear all I would like to superpose some smoothing line through boxplot in ggplot > dput(ad) structure(list(konc.f = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 6L, 6L, 6L, 7L, 7L, 7L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L,
2009 Feb 02
1
Specifying the gap between "dodge'd" bins groups?
I'm looking at ggplot-static\position_dodge.html   For ggplot(diamonds, aes(x=price, fill=cut)) + geom_bar(position="dodge") , is it possible to specify the spacing between the dodge'd bin groupings?    That is, I would like for there to be a small separation (horizontal space) between the "Ideal" and the "Fair&...
2011 Aug 29
1
Legend / bar order - ggplot2
...name = factor(rep(letters[1:10], 2), levels = letters[1:10]), type = factor(c(rep("orig", 10), rep("match", 10)), levels = c("orig", "match"))) ggplot(df, aes(x = name, y = value, fill = type)) + geom_bar(position = position_dodge()) + coord_flip() Thank you very much, YL
2011 Dec 21
3
black and white in qplot? layout 4 graphs in one screen
...667 ... Current code is: Ab.avg<-ddply(June, c("TRT", "habitat"), function(df) return(c(Ab.avg=mean(df$Abundance), Ab.sd=sd(df$Abundance)))) avg.plot<-qplot(TRT, Ab.avg, fill=factor(habitat), data=Ab.avg, geom="bar", position="dodge") dodge <- position_dodge(width=0.9) avg.plot++geom_linerange(aes(ymax=Ab.avg+Ab.sd, ymin=Ab.avg-Ab.sd), position=dodge)+theme_bw() http://r.789695.n4.nabble.com/file/n4223035/june_bar_graph.png Also, would like to plot 4 of these bar graphs (for four dates) on the same screen, I cannot get the par() or layout() function...
2012 Jul 26
2
Error Bars ggplot2
...s","s","f","f","s","f") r<-c(4.9,3.2,2.1,.2,3.8,6.4,7.5,1.7,3.4,4.1,2.2,5) #Turn spd into a factor spd.f<-factor(spd) #Place data into a data frame data<-data.frame(cbind(spd.f,r)) #Load ggplot2 library(ggplot2) #Create plot pd<-position_dodge(.2) myplot<-ggplot(data,aes(x=spd,y=r,colour=spd))+ geom_errorbar(aes(ymin=3,ymax=5),width=.1)+ geom_point()+ geom_errorbar(aes(ymin=1,ymax=6),width=.1,colour="black",position=pd) #Display plot myplot I have attached a plot that my sample code produces. As you can see the error...
2008 Dec 16
1
Prediction intervals for zero inflated Poisson regression
...] <- t(apply(bootstrap, 1, quantile, c(0.025, 0.975))) newdata0$model <- "Zero inflated" #compare the intervals in a nice plot. newdata <- rbind(newdata, newdata0) library(ggplot2) ggplot(newdata, aes(x = fem, y = fit, min = X1, max = X2, colour = model)) + geom_point(position = position_dodge(width = 0.4)) + geom_errorbar(position = position_dodge(width = 0.4)) Best regards, Thierry ------------------------------------------------------------------------ ---- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodo...
2009 Feb 02
1
Broke ggplot...
...hs_flat_df<-rbind(VADeaths_flat_tmp1, VADeaths_flat_tmp2) VADeaths_flat_df<-rbind(VADeaths_flat_df, VADeaths_flat_tmp3) VADeaths_flat_df<-rbind(VADeaths_flat_df, VADeaths_flat_tmp4) bin_size<-15.0 ggplot(VADeaths_flat_df, aes(x = factor(Data), fill = factor(Person))) + geom_bar(position=position_dodge(width =(20)), binwidth=20) # or ggplot(VADeaths_flat_df, aes(x=factor(Data))) + geom_histogram(binwidth=20)    Thanks again for any feedback you provide. [[alternative HTML version deleted]]
2009 Apr 23
1
ggplot2/aesthetic plotting advice
...from both a procedural and an aesthetic point of view, what do people recommend? Below is an example that hacks (not quite "jitters", because it's systematic) the x locations a bit, but I find it a bit ugly. (I was also hoping that ggplot had some magic to do this automatically, but position_dodge doesn't seem to work in this context ...) Ben Bolker library(ggplot2) nx <- 3 ngrp <- 5 nper <- 4 x <- rep(1:nx,ngrp*nper) y <- runif(nx*ngrp*nper) g <- factor(rep(1:ngrp,each=nx*nper)) dat <- data.frame(x,y,g) se <- with(dat,tapply(y,list(g,x),sd)/table(g,x)) mea...
2012 Mar 12
1
ggplot2: coord_polar
...it) Any thoughts? Many Thanks, A. ## code segment starts here df <- data.frame( trt = factor(c(1, 1, 2, 2)), resp = c(1, 5, 3, 4), group = factor(c(1, 2, 1, 2)), se = c(0.1, 0.3, 0.3, 0.2) ) df2 <- df[c(1,3),] limits <- aes(ymax = resp + se, ymin=resp - se) dodge <- position_dodge(width=0.9) p <- ggplot(df2, aes(fill=group, y=resp, x=trt)) p <- p + geom_bar(position=dodge) # This is OK print(p) # This is OK print(p + coord_polar()) p <- p + geom_errorbar(limits, position=dodge, width=0.25) # This is OK print(p) # Error at the next statement print(p + coord_po...
2011 Nov 09
2
plot separate groups with plotmeans()
Hi, I often use plotmeans() from the gplots package to quickly visualize a pattern of change. I would like to be able to plot separate lines for different groups, but the function gives an error when a grouping variable is included in the formula argument. For instance, > require(gplots) > x <- data.frame(Score=rnorm(100), Time=rep(1:10, 10),
2011 Jun 30
1
Italicized greek symbols in PDF plots
...icized delta dat$gltr = factor(c("italic(\u03b4)^14*N","italic(\u03b4)^15*N","italic(\u03b4)^13*C")) #So this is what I want my plot to look like: plt <- ggplot(data = dat, aes(x = yy, y = x)) + geom_point(aes(x= yy, y=x, shape=z, group=z), alpha=0.4,position = position_dodge(width = 0.8)) + facet_grid(gltr~.,labeller= label_parseall, scales="free_y") plt #So then I exported my plot as a PDF like so: pdf("Times_regular.pdf", family='Times') plt dev.off() #The problem with this was that the delta symbols turned into dots. #I solved this...
2010 Nov 30
2
ggplot2 histograms
Hi With ggplot2 I can very easily create beautiful histograms but I would like to put two histograms on the same plot. The histograms may be over-lapping. When they are overlapping the bars are shown on top of each other (so that the overall height is the sum of the two). Is there any way to get them to display overlapping (with smaller value in front, larger value behind) so that the overall
2010 Dec 17
1
ggplot missing fill colours in boxplot legend
Hello, I am trying to create a series of boxplots with the following data, three columns, "Day" (1 or 2), "Site" (1-4), and "VO2" (some values missing for some Sites or Days) > CorbulaMR3 Day Site VO2 1 1 1 88.92223 2 1 1 86.17873 3 1 1 61.08950 4 1 1 190.47922 5 1 1 98.65930 6 1 1 121.03549 7 1 1 67.88404 8
2010 Dec 06
2
ggplot2: Controlling line width of panel borders
...m: library(ggplot2) library(lattice) barley[["SD"]] <- 5 limits <- aes(ymax=barley$yield + barley$SD,ymin=barley$yield - barley$SD) p1 <- ggplot(barley,aes(fill=year,y=yield,x=variety)) p2 <- p1 + geom_bar(position="dodge",stat="identity") dodge <- position_dodge(width=0.9) p3 <- p2 + geom_errorbar(limits,position=dodge,width=0.5,size=0.7) p4 <- p3 + facet_wrap(~site,ncol=2) p5 <- p4+theme_bw(base_size=16) p5 last_plot() + opts(panel.grid.minor=theme_blank()) # deletes the minor grid lines ## Now i would like to increase the width of all rema...
2013 Mar 06
6
Ggplot2: Moving legend, change fill and removal of space between plots when using grid.arrange() possible use of facet_grid?
Hi, # For publications, I am not allowed to repeat the axes. I have tried to remove the axes using: # yaxt="n", but it did not work. I have not understood how to do this in ggplot2. Can you help me? # I also do not want loads of space between the graphs (see below script with Dummy Data). # If I could make it look like the examples on the (nice) examples page: #