Closed
Description
Before ggplot v2.0.0 the following piece of code worked without problems
library(ggplot2)
x <- (1:8)
y <- sin(x)
z <- letters[1:2]
dat <- data.frame(x, y, z)
g <- ggplot(dat, aes(x, y, group = z, colour = z, fill = z)) + geom_area(alpha = 0.5)
t <- theme_bw() + theme(legend.position = "bottom")
g + t
# now with half height legend keys
t1 <- t + theme(legend.key.height = 0.5 * t$legend.key.size )
g + t1
Now, with ggplo2 v.2.0.0 I get the error message:
> Error in FUN(X[[i]], ...) : Unknown input
It seems that theme() does no longer accept objects of class unit.arithmetic.
WORKAROUND:
t2 <- t + theme(legend.key.height = unit(0.5 * as.numeric(t$legend.key.size),
attr(t$legend.key.size, "unit")))
g + t2
May be I'm have missed a point.
Best regards,
Uwe