Change label location on facet_grid() plot

2,341 views
Skip to first unread message

Brandon Farr

unread,
Jan 25, 2011, 8:05:51 AM1/25/11
to ggplot2
All,

Does any know how, if possible, to change the label locations on a
facet_grid plot? By default the x labels are on the top, and the y
labels are on the right. I want the x labels on the top and the y
labels on the LEFT.

Thanks,
Brandon

Brandon Hurr

unread,
Jan 25, 2011, 3:32:43 PM1/25/11
to Brandon Farr, ggplot2
Brandon, 

In a faceted plot the x axis is always on the bottom with y axis on the left. The facet names are on top. To my knowledge you can't change the position of one for another.  If I'm wrong I hope someone will correct me. 

Brandon


--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442

To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

Kohske Takahashi

unread,
Jan 25, 2011, 10:56:36 PM1/25/11
to Brandon Hurr, Brandon Farr, ggplot2
Hi,

this is half in jest,

d <- data.frame(expand.grid(a=1:2,b=1:2,c=1:2),x=rnorm(8), y=rnorm(8))

p <- ggplot(d, aes(x, y)) + facet_grid(a~b) + geom_point() +
coord_trans(x="reverse", y="reverse") +
opts(strip.text.x=theme_text(angle=180),
strip.text.y=theme_text(angle=90),
axis.text.x=theme_text(angle=180),
axis.text.y=theme_text(angle=180),
axis.title.x=theme_text(angle=180),
axis.title.y=theme_text(angle=180))

print(p, vp=viewport(angle=180))

maybe you can see some unnecessary lines, then,

print(p)

and save the graphics as image file or PDF, then rotate it.

But I don't recommend this. This trick is just for joke.

--
Kohske Takahashi <takahash...@gmail.com>

Research Center for Advanced Science and Technology,
The University of  Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html

Reply all
Reply to author
Forward
0 new messages