Here is the quick fix:
library(ggplot2)
library(proto)
GeomBoxplot2 <- proto(ggplot2:::GeomBoxplot, {
objname <- "boxplot2"
guide_geom <- function(.) "boxplot2"
draw_legend <- function(., data, ...) {
data <- aesdefaults(data, .$default_aes(), list(...))
gp <- with(data, gpar(col=colour, fill=alpha(fill, alpha),
lwd=size * .pt, lty = linetype))
gTree(gp = gp, children = gList(
linesGrob(0.5, c(0.1, 0.25)),
linesGrob(0.5, c(0.75, 0.9)),
rectGrob(height=0.5, width=0.75),
linesGrob(c(0.125, 0.875), 0.5)
))
}
})
geom_boxplot2 <- function (mapping = NULL, data = NULL, stat =
"boxplot", position = "dodge",
outlier.colour = "black", outlier.shape =
16, outlier.size = 2,
notch = FALSE, notchwidth = .5, ...) {
GeomBoxplot2$new(mapping = mapping, data = data, stat = stat,
position = position, outlier.colour =
outlier.colour, outlier.shape = outlier.shape,
outlier.size = outlier.size, notch = notch,
notchwidth = notchwidth, ...)
}
ggplot(mpg, aes(x=manufacturer, y=cty, linetype=factor(year))) + geom_boxplot2()
2012/7/5 nigol <
dario....@gmail.com>:
> library(ggplot2)
> ggplot(mpg, aes(x=manufacturer, y=cty, linetype=factor(year))) +
> geom_boxplot()
--
Kohske Takahashi <
takahash...@gmail.com>
Assistant Professor,
Research Center for Advanced Science and Technology,
The University of Tokyo, Japan.
http://www.fennel.rcast.u-tokyo.ac.jp/profilee_ktakahashi.html