Hi:
Is this what you wanted? This should work for version 0.9.2 +. Some comments:
(1) modifyList() is no longer supported in the new theming system; use
the %+replace% operator instead.
(2) I added fill = NA to panel.border's properties because without it,
the fill color overwrites the graphics panel region and you get what
looks like an empty plotting region (although it really isn't).
(3) Notice how the element properties are modified inside theme()
rather than list(). This is consistent with the notion of replacing
specific element properties of theme_bw().
(4) The new theming system supports inheritance of properties, so it
is now only necessary to specify axis.text rather than both
axis.text.x and axis.text.y; they both inherit the property size = 15
from axis.text. Since there was only one common property in
axis.title.x and axis.title.y, I left them alone.
theme_boxplot2 <- function(base_size = 12)
{
theme_bw(base_size) %+replace%
theme(legend.key.size=unit(15,"points"),
legend.text=element_text(size=I(13)),
legend.key=element_blank(),
legend.title=element_blank(),
legend.position="none",
plot.margin=unit(c(0.25,2,0.25,2), "lines"),
panel.border=element_rect(colour='black', fill = NA),
panel.margin=unit(0,"lines"),
axis.ticks.length=unit(1,"mm"),
axis.ticks.margin = unit(0, "lines"),
axis.text=element_text(size=15),
axis.title.x=element_text(hjust=.55, vjust=-.01, size=17),
axis.title.y=element_text(size=17, angle=90,
hjust=.56, vjust=-.001),
panel.grid.major=element_blank(),
panel.grid.minor=element_blank(),
strip.text.x=element_text(size=14),
strip.background=element_rect(colour='black', fill='white')
)
}
ggplot(data=cars, aes(x=factor(speed), y=dist)) + geom_boxplot() +
xlab("speed") + ylab("distance") + theme_boxplot2()
Dennis
On Tue, Nov 27, 2012 at 10:44 AM, Rachael <
rachael...@gmail.com> wrote:
> ggplot(data=cars, aes(x=factor(speed), y=dist)) + geom_boxplot() +
> xlab("speed") + ylab("distance") + theme_boxplot2()