facet_wrap problem

90 views
Skip to first unread message

Meike Kern

unread,
Jul 26, 2012, 12:01:54 PM7/26/12
to ggp...@googlegroups.com
Hello,
I am new to ggplot2 and I can't to get my graphs to work.
I am trying to do kinda simple facet_wrap plots, plotting total dry weight oder Shell lenght and "facet_wrap" it for the different sites at which i sampled. But i always get the error message: layout_base

graph<-ggplot(data=data, aes(x=sL, y=tdw, colour=species))+geom_point(data = data,  size =3)+theme_bw()
> graph1<-graph+labs(x="shell length in (mm)" , y= "Shell dry weight")
> graph1
> graph2<-graph1+facet_wrap(Site~)
Fehler: Unerwartete(s) ')' in "graph2<-graph1+facet_wrap(Site~)"
> graph2
Fehler in layout_base(data, cols, drop = drop) : 
  At least one layer must contain all variables used for facetting

does anybody know where how i could fix this problem??

Thank you for the help


Ista Zahn

unread,
Jul 26, 2012, 1:08:55 PM7/26/12
to Meike Kern, ggp...@googlegroups.com
Hi,

The first problem is in your facet_wrap() call, which should be
facet_wrap(~Site), NOT facet_wrap(Site~). Since this returns an error,
and graph2 is not (re)assigned, I can't see how graph2 was actually
created. Start by fixing your facet_wrap() problem and see if that
fixes things.

Best,
Ista
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
Reply all
Reply to author
Forward
0 new messages