facet_wrap(~ Site, ncol = 3)The graph structure by default is the following (p.116 ggplot2 book):
1 2 3 4 5 6 7 8 9
But if there is only 8 panels to draw, then the last panel is empty (only 8 sites not 9) but still
the labels (ticks and numbers) are shown for this empty panel (as the example in p.121 ggplot2 book).
Is it possible to change the order by which the grids are filled (so that the empty panel will be the upper right one, without ticks and numbers)? For example.
7 8 9
4 5 6
1 2 3
Or is it possible to remove the ticks and numbers of a selected panel?
Thank you in advance.
Yann
Yann Hautier wrote:
> Hi,
>
> Here is my question.
>
> I am drawing a graph with 8 panels with qplot and use the function
> facet_wrap to maximize the graph space:
>
> facet_wrap(~ Site, ncol = 3)
>
> But if there is only 8 panels to draw, then the last panel is empty (only 8 sites not 9) but still
> the labels (ticks and numbers) are shown for this empty panel (as the example in p.121 ggplot2 book).
> Is it possible to change the order by which the grids are filled (so that the empty panel will be the upper right one, without ticks and numbers)? For example.
>
> 7 8 9
> 4 5 6
> 1 2 3
>
d =
data.frame(x=runif(800),y=runif(800),f=factor(rep(LETTERS[1:8],each=100)))
library(ggplot2)
ggplot(d,aes(x=x,y=y))+
geom_point()+
facet_wrap(~f,ncol=3)
ggplot(d,aes(x=x,y=y))+
geom_point()+
facet_wrap(~f,ncol=3,as.table=FALSE)
appears to do the trick.