How to remove y axis scale and label for box plot

3,309 views
Skip to first unread message

Tom Song

unread,
Sep 14, 2009, 10:32:17 PM9/14/09
to ggplot2
Hi,

Is it possible to remove the y axis scale and label for a box
plot? Thanks!

Tom

Juliet Hannah

unread,
Sep 15, 2009, 10:53:37 AM9/15/09
to Tom Song, ggplot2
You can view options by

theme_get()

Here, we see options that correspond to the axis. One way to modify these is:

p <- ggplot(mtcars, aes(factor(cyl), mpg))
p <- p + geom_boxplot(aes(fill = cyl, colour = cyl), size = 1.9)
p <- p + opts(axis.text.x = theme_blank(), axis.title.x=theme_blank())
p

smu

unread,
Sep 15, 2009, 11:16:02 AM9/15/09
to ggplot2

like this?

library(ggplot2)

d = data.frame(x=1,y=rnorm(100))
ggplot(d,aes(x,y)) + geom_boxplot() +
opts(axis.ticks = theme_blank(),
axis.title.y = theme_blank(),
axis.text.y = theme_blank())

But this removes the ticks on both axes and I don't find a way to remove
only the y ticks. axis.ticks.y does not work.

regards,
stefan
Reply all
Reply to author
Forward
0 new messages