search for: facet_wrap

Displaying 20 results from an estimated 159 matches for "facet_wrap".

2008 Dec 03
2
ggplot2 - suggestion for facet_wrap/grid
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20081203/26bd4ac1/attachment.pl>
2009 Jan 07
1
Problem with ggplot2 - facet_wrap and boxplot
...f.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 geom_point p + geom_point(aes(color = group)) + facet_wrap(~group) Best regards. david [[alternative HTML version deleted]]
2009 Oct 29
1
multiple pages with ggplot2 facet_wrap?
...2 pages of 4 panels each. "diamonds" is a data.frame distributed with ggplot2. I would like to do the same with ggplot2 but have been unsuccessful. The following sequence of statements seemed like a logical way to do it: p <- ggplot(diamonds, aes(carat, price)) p + geom_point() + facet_wrap(~clarity, ncol = 2, nrow = 2) But they result in the error statement: "Error in nrow * ncol : non- numeric argument to binary operator". Is facet_wrap or facet_grid capable of producing multiple pages of plots and, if so, how? Thanks, Bill William R Gillespie, VP Strategic Modeling...
2017 Nov 10
1
How to create separate legend for each plot in the function of facet_wrap in ggplot2?
Hi R users, I need to create more than 20 figures (one for each group) in one page. I have a common legend for 20 figures using the facet_wrap. However the range of the values among the groups are very wide. For example one group has the value of 0 to 3, but the values of some of the groups has ranged from 0 to 20 so that when I used a single common legend for all 20 figures, I could not display the contrast of the values in some of the f...
2011 Jun 07
2
ggplot2 and facet
...3 -0.20726073 04R 1 > > sapply(times, class) time error runway flight "numeric" "numeric" "factor" "factor" I want to plot this using ggplot2 library(ggplot2) pp2 = qplot(times$time, times$error, times) pp2 = pp2 + facet_wrap(~ times$runway) print(pp2) But when I try it, I get the error Error in fix.by(by.x, x) : 'by' must specify valid column(s) I get the same error if I make times$time a factor: > > times$time = as.factor(times$time) > > sapply(times, class) time error runway fl...
2013 Feb 18
1
ggplot2 and facet_wrap help
...39; names(mydf)[3] = 'clarity' names(mydf)[4] = 'median_price' # So my data is already in a "long" format I think, but when I do this: ggplot(data=mydf, aes(x=mydf$size2, y=mydf$median_price, group=as.factor(mydf$clarity), colour=as.factor(mydf$clarity))) + geom_line() + facet_wrap(~ factor(mydf$size1)) I get this error: "Error in layout_base(data, vars, drop = drop) : At least one layer must contain all variables used for facetting" Can you please help me understand what I am doing wrong? -fra
2009 Aug 11
1
ggplot2: override facet names in facet_wrap?
just a quick question (to which I suspect the answer is "no"): does anyone know if, in the ggplot2 package, there's a way to override the default names of the facets in facet_wrap (which correspond to the levels of the factor used to facet)? I know that I go back and change the levels of the factor, but it would be convenient to be able to supply a vector of level names at the time of plotting ... cheers Ben Bolker -------------- next part -------------- A non-text...
2008 Nov 22
2
ggplot2 - facet_grid and facet_wrap
...;, "J", "H", "C"), row.names = c(NA, 4L), class = "data.frame") mdat <- melt(dat, id = "D") qplot(D, value, data = mdat, fill = D, geom = "bar") + facet_grid(~ variable) qplot(D, value, data = mdat, fill = D, geom = "bar") + facet_wrap(~ variable) The first plot is good, but I think there is a problem in the second plot : the barplots are not in the correct order (compare "G" in the first plot and in the second plot for example). I join a pdf file showing the two graphs. Something is wrong in my code ? Thank you ve...
2010 May 18
2
Function that is giving me a headache- any help appreciated (automatic read )
...ipitation!="NA") b <- ddply(precip.1$precipitation, .(precip.1$gauge_name), cumsum) DF.precip <- precip.1 DF.precip$precipitation <- b$.data #discharge if(input=="data"){ return(DF) }else{ qplot(Date, discharge, data=DF, geom="line", ylab="Date")+facet_wrap(~gauge_name, scales="free_y")+coord_trans(y="log10")} if(input=="precipitation"){ #precipitation qplot(Date, precipitation, data=DF.precip, geom="line")+facet_wrap(~gauge_name, scales="free_y") }else{ qplot(Date, discharge, data=DF, geom="li...
2016 Jun 24
3
Ayuda ggplot2
...Soy nueva en R y necesito hacer unos gráficos para una investigación, he explorado un poco y estoy intentando usar ggplot2 ya que hace gráficos de muy buena calidad...tengo los datos de varios años para diferentes grupos de empresas y los pretendo graficar tanto en un solo grafico como en varios (facet_wrap) pero tengo problemas con el eje de las X, ya que necesito que aparezcan los años es decir, 2003, 2004 y así ....y no X2003, X2004 que es como están apareciendo. Este es mi código: library(reshape2) library(ggplot2) emp <- read.csv("C:/Users/usuario/Documents/tamano_empresas.csv", h...
2011 Jun 08
3
How to suppress factor labels
...plot2 to make a boxplot that overlays a scatterplot: 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 la...
2013 Mar 07
3
ggpliot2: reordering of factors in facets facet.grid(). Reordering of factor on x-axis no problem.
...(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() + ylab(expression(paste("my measured stuff"))) + xlab("factor3") + theme(legend.position="none")+ labs(shape = "factor1", group = "fac...
2010 May 31
1
Can not save plot to png file correctly
You can save as png like this too: library(ggplot2) data=data.frame( ? X=sample(10,1000,replace=T) ? , Y=letters[1:10]) png("mypng.png") qplot(X, data=data, geom='histogram') + facet_wrap( ~ Y) dev.off() ? Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA ----- Original Message ---- > From: Peng Yu <pengyu.ut at gmail.com> > To: ggplot2 <ggplot2 at googlegroups.com> > Sent: Mon, May 31,...
2009 Jan 22
1
ggplot2 example
I need to plot two graphics just like the example below but for some reason your example crashes. Using facet_wrap seems to be the cause: library(ggplot2) upper <- with(economics, data.frame(date,value = psavert, position = "upper")) upper lower <- with(economics, data.frame(date,value = unemploy,position = "lower")) lower #upper$date <- as.Date(upper$date,"%m/%d/%Y") #low...
2018 Mar 12
2
ggplot and boxplots
...84.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 Desc: not avail...
2013 Oct 12
2
Order of factors with facets in ggplot2
...e= 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]]
2008 Dec 14
0
New version of ggplot2, 0.8.1
...either into (TRUE) or out of (FALSE) the legend Bug fixes * coord_equal now calculates scales correctly again * coord_flip: flips axes labels again too * coord_trans fix bug where transformation incorrect * facet_grid: fix bug where tick labels where being produced outside the range of the axes * facet_wrap: fixed bug with ncol = 1 or nrow = 1 * facet_wrap: labels correctly clipped to axis ranges * facet_wrap: labels will match panels even when factor levels are not in alphabetical order * facet_wrap: now works when a layer doesn't contain every level of the faceting variables * geom_abline should...
2008 Dec 14
0
New version of ggplot2, 0.8.1
...either into (TRUE) or out of (FALSE) the legend Bug fixes * coord_equal now calculates scales correctly again * coord_flip: flips axes labels again too * coord_trans fix bug where transformation incorrect * facet_grid: fix bug where tick labels where being produced outside the range of the axes * facet_wrap: fixed bug with ncol = 1 or nrow = 1 * facet_wrap: labels correctly clipped to axis ranges * facet_wrap: labels will match panels even when factor levels are not in alphabetical order * facet_wrap: now works when a layer doesn't contain every level of the faceting variables * geom_abline should...
2010 Jan 18
2
ggplot2 histogramm
...riable=sample(c("A","B","C"),1000,replace=T,prob=c(0.22,0.28,0.5)),group=gl(2,500)) p <- ggplot(df, aes(x = variable)) p + geom_histogram(aes(y= ..count.. / sum(..count..),fill=..count../sum(..count..)*100)) + scale_y_continuous(formatter = "percent") + facet_wrap(~group) + ylab("Anteil in %") + xlab("Attribute") + opts(title="Title",legend.text="Anteil in Prozent") + BaseTheme(base_size=12) many thanks, Christian
2011 Sep 30
2
ggplot2 - extracting values of smooth
...ome hex binning q<-qplot(carat,price,data=diamonds, geom=c("hex"), main="Variability of Diamond Prices by Carat and Colour") #facet to get one scatter for each colour, plus overlay a black coloured loess smoothed line showing the trends in the data q + facet_wrap(~color,ncol=2)+geom_smooth(aes(group=1),colour=I("black")) Nice picture, but how do I extract the values of the smoothed line? Many thanks, dM/