@@ -17,14 +17,26 @@ GeomBoxplot <- proto(Geom, {
17
17
stringsAsFactors = FALSE
18
18
))
19
19
defaults2 <- defaults [c(1 ,1 ), ]
20
-
21
- with(data , ggname(. $ my_name(), gTree(children = gList(
22
- if (length(outliers [[1 ]]) > = 1 ) GeomPoint $ draw(data.frame (y = outliers [[1 ]], x = x [rep(1 , length(outliers [[1 ]]))], colour = I(outlier.colour ), shape = outlier.shape , size = outlier.size , fill = NA ), ... ),
20
+
21
+ if (! is.null(data $ outliers ) && length(data $ outliers [[1 ]] > = 1 )) {
22
+ outliers_grob <- with(data ,
23
+ GeomPoint $ draw(data.frame (
24
+ y = outliers [[1 ]], x = x [rep(1 , length(outliers [[1 ]]))],
25
+ colour = I(outlier.colour ), shape = outlier.shape ,
26
+ size = outlier.size , fill = NA ), ...
27
+ )
28
+ )
29
+ } else {
30
+ outliers_grob <- NULL
31
+ }
32
+
33
+ with(data , ggname(. $ my_name(), grobTree(
34
+ outliers_grob ,
23
35
GeomPath $ draw(data.frame (y = c(upper , ymax ), defaults2 ), ... ),
24
36
GeomPath $ draw(data.frame (y = c(lower , ymin ), defaults2 ), ... ),
25
37
GeomBar $ draw(data.frame (ymax = upper , ymin = lower , defaults ), ... ),
26
38
GeomBar $ draw(data.frame (ymax = middle , ymin = middle , defaults ), ... )
27
- ))))
39
+ )))
28
40
}
29
41
30
42
objname <- " boxplot"
0 commit comments