Displaying 20 results from an estimated 186 matches for "facet_grid".
2016 Apr 20
2
overlay two facet_grid
Hi all,
Does anyone know how to overlay two facet_grids? I have two facet grids as following:
ggplot(data=df,aes(x=TE,y=TR,color="orange"))+geom_point()+facet_grid(FS+TRJ~OR+INV,labeller=label_both)+xlim(0,200)+ylim(0,10000)
ggplot(data=df,aes(x=TE,y=TR))+geom_point(aes(color=TST))+facet_grid(FS+TRJ~OR+INV,labeller=label_both)+xlim(0,200)+y...
2009 Oct 02
1
ggplot2: proper use of facet_grid inside a function
Hello Again R Folk:
I have found items about this in the archives, but I?m still not getting
it right. I want to use ggplot2 with facet_grid inside a function with
user specified variables, for instance:
p <- ggplot(data, aes_string(x = fac1, y = res)) + facet_grid(. ~
fac2)
Where data, fac1, fac2 and res are arguments to the function. I have
tried
p <- ggplot(data, aes_string(x = fac1, y = res)) + facet_grid(. ~
as.na...
2010 Oct 28
1
ggplot2: facet_grid with only one level does not display the graph with the facet_grid level in title
Hi All,
Here is the code that I'll be referring to:
p <- ggplot(wastran.data, aes(PER_KEY, EVENTS))
(p <- p +
facet_grid( pool.short ~ .) +
stat_summary(aes(y=EVENTS), fun.y = sum, geom="line") +
opts(axis.text.x = theme_text(angle = 90, hjust=1), title="Events
(15min.) vs. Time: Facet pool", strip.text.y = theme_text())
)
Now, depending on preceding parameters, the 'pool.short'...
2016 Apr 20
0
overlay two facet_grid
...ill be unlikely to appear, so read the above link and pay attention to the dput function.
--
Sent from my phone. Please excuse my brevity.
On April 20, 2016 3:01:43 PM PDT, "ch.elahe via R-help" <r-help at r-project.org> wrote:
>Hi all,
>Does anyone know how to overlay two facet_grids? I have two facet grids
>as following:
>
>
>ggplot(data=df,aes(x=TE,y=TR,color="orange"))+geom_point()+facet_grid(FS+TRJ~OR+INV,labeller=label_both)+xlim(0,200)+ylim(0,10000)
>ggplot(data=df,aes(x=TE,y=TR))+geom_point(aes(color=TST))+facet_grid(FS+TRJ~OR+INV,labeller=label...
2010 Nov 09
1
ggplot2: facet_grid with different vertical lines on each facet
Hello,
I am plotting many histograms together using facet_grid in ggplot2. However,
I want to then add a vertical line to each histogram, or facet, each of
which vertical lines are at different x-values.
The following example adds all vertical lines to each facet:
ggplot(data,aes(values)) + geom_histogram() + facet_grid(.~variable) +
geom_vline(xintercept=c(5...
2011 Jan 18
2
ggplot2, geom_hline and facet_grid
Hi
I have a long data set on which I want to do Bland-Altman style plots for each rhythm type
Using ggplot2, when I use geom_hline with facet_grid I get an extra set of empty panels.
I can't get it to do it with the "Diamonds" data supplied with the package so here is a (much abbreviated) example:
> lvexs
cvd_basestudy ecd_rhythm fixed_time variable_time
1 CBP05J02 AF 30.9000 29.4225
2 CBP05J0...
2008 Jan 26
2
using facet_grid() from ggplot2 with additional text in labels
Hi
I am using ggplot2 at the moment and I must say it is definitely better
then ggplot - good work.
My problem is that I am using facet_grid() in the following way:
> p <- ggplot(ssq, aes(x=year, y=-log(ssq)))
> p + geom_point() + facet_grid(me*gi~cs*rz)
and it works nicely, except that I would like to have, in naddition to
the values of me, gi, cs and rz the name of the variable. I.e: if gi is
1, 2 and 3 I would like to...
2008 Mar 25
2
ggplot2 - facetting
...s4'))))
plotdata2 <- plotdata2[order(plotdata2[,'group']),]
plot0<-ggplot()
layer1<-layer(data=plotdata2,
mapping=aes_string(x='x',y='y'),geom='point', stat='identity')
scaleY<-scale_y_continuous()
scaleX <- scale_x_continuous()
Facets<-facet_grid(group ~ .)
plot1<-plot0+layer1 +scaleY + scaleX + facet_grid(group~.)
plot1
I always get the error message:
Error in check_formula(formula, varnames) :
Formula contains variables not in list of known variables
Thanks for any help you can provide.
Best,
Pedro
2008 Jan 27
1
Putting frame around single panels in ggplot 2 and facet_grid()
Hi
I want to highlight two panels in a grid created with facet_grid() by
putting a box around it or usiong another background colour. Is this
possible, and if yes, how?
Thanks
Rainer
--
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)
Plant Conservation Unit
Department of Botany
University of Cape Town
Rondebosch 7701
South Africa
Tel:...
2013 Nov 12
0
geom_abline does not seem to respect groups in facet_grid [ggplot2]
...e).
library(ggplot2)
library(Hmisc)
ggp <- ggplot(dt,aes(x=cohort, y=score)) + ylim(0,100)
ggp <- ggp + stat_summary(fun.data="mean_cl_normal")
ggp <- ggp + geom_abline(aes(slope=0,intercept=mean(score)),color="blue",linetype="dashed")
ggp <- ggp + facet_grid(subject~.)
ggp
The problem is that the reference line (from geom_abline) is the same in all facets (= the grand average score for all students and
all subjects). So stat_summary seems to respect the grouping implied in facet_grid (e.g., by subject), but abline does not. *Why*?
NB: I realiz...
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>
2008 Nov 22
2
ggplot2 - facet_grid and facet_wrap
..."G", "E", "I", "B", "F", "A", "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)....
2011 Dec 23
1
simple ggplot2 question
Hello,
I am trying to make a plot using the code below. The plot is divided into two parts, using facet_grid. I would like the vertical axis (labelled 'place') to be different for each location (=part). So in the upper part, only places 'n' through 'z' are shown, while in the lower part, only places 'a' through 'm' are shown. I thought 'free_y' would do the...
2011 Aug 23
3
Linear Regression with 2 grouping variables
...ntervals from 10-70.. I am primarily
interested in the relationship between "Time" and "lnRFU" to calculate the
rate at which lnRFU declines over time. I have a nice plot using a ggplot2
code that looks like this
p<-ggplot(data=feed1,aes(x=Time,y=lnRFU))
p+geom_point(size=4)+facet_grid(Site~Vial)+geom_smooth(method="lm")
The graph is useful to visualize the changes over time and grouped by both
Site and Vial, but I also need the slopes of the linear regressions for each
Vial, within a Site. This is where I run into a problem. I want to run a
linear regression of lnRFU...
2013 Sep 18
1
ggplot2: changing strip text in facet_grid and a legend text problem
Hi,
Dummy data script and scripts are attached below.
I would like to change the plot to look like this:
https://www.google.se/search?q=facet_grid&bav=on.2,or.r_qf.&bvm=bv.52288139,d.Yms&biw=1454&bih=704&dpr=1&pdl=300&um=1&ie=UTF-8&hl=sv&tbm=isch&source=og&sa=N&tab=wi&ei=vY05Uu3vD8aHtAawsYDIBw#facrc=_&imgdii=_&imgrc=IyGjjRic2YJAsM%3A%3BzWmfhhY7LA1p2M%3Bhttps%253A%252F%252Fgithub-...
2008 May 12
1
Converting qqplot2 qplot() to grammar?
Hello all,
I've been using the following qplot command:
qplot(pixX,pixY, data=som, geom="tile", fill=rgb) +
scale_fill_identity() + opts(aspect.ratio = .75) + facet_grid(unitX ~ unitY)
Now I would like to convert it into the explicit ggplot grammar, so I
can remove the extras: axes, labels, background, borders, facet labels,
and extra white-space around the plot. (If anyone has suggestions on
removing these please let me know)
I've come up with the following...
2012 Oct 30
4
Error unary operator
Hi R - listers,
I am receiving an error. Does anyone know what this means? J
ggplot(subset(foo, Rayos != "Rayos.NA"), aes(x=HTL, y=DevelopIndex,
colour=TotalEggs)) +geom_point() +geom_jitter() +
facet_grid(Aeventexhumed ~ Rayos)
+ geom_smooth(method="lm", fill=NA) + ylim(c(0, 7))
Error in +geom_smooth(method = "lm", fill = NA) :
invalid argument to unary operator
[[alternative HTML version deleted]]
2013 Mar 06
6
Ggplot2: Moving legend, change fill and removal of space between plots when using grid.arrange() possible use of facet_grid?
...ood 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:
# http://www.ling.upenn.edu/~joseff/rstudy/summer2010_ggplot2_intro.html
# using the facet_grid(), I would be very very happy.
# I also do not want the gemoetric points to be filled and the fill="white"
commande
# does not seem to work - why? and are there alternatives?
#Furthermore, I would like to add legends to inside the plot area instead of
on the side. Like when you use pl...
2011 May 28
1
ggplot pale colors
...with the colors.
Here is a first example:
dataset <- data.frame(Main = c("A", "A", "B", "B"), Detail = c( "b", "c", "1", "2"), resp = runif(4, min = 0.5, max = 1))
ggplot(dataset, aes(x = Detail, y = resp)) +
facet_grid(.~Main, scales = "free_x")+ geom_point(aes( size=6,shape = c(16,16,15,15) ),colour="blue")+geom_hline(aes(yintercept=0.25),colour='blue', size=2)
with this code all the point are blue (like the line below)
But if i try the following code, where my goal is to have th...
2012 Aug 07
2
label_wrap_gen question
Hi, all
I am trying to use the label_wrap_gen function in this website.
https://github.com/hadley/ggplot2/wiki/labeller
I tried to make a long name like this
Light and heavy good vehicles (diesel) -\nGVX
f2 = facet_grid(vehicle ~ ., labeller=label_wrap_gen(width=15))
eventually, I got something like this in my label...
*Light and heavy
good vehicles
(diesel) - GVX*
I suppose the "-n" could break GVX to the next row but it failed...
Is it a bug? or it has been overpowered by "width=15"?? so &...