Permalink
Browse files

Fix stat_summary examples that use geom_crossbar. Fixes #775

  • Loading branch information...
1 parent ece6dcb commit c9800332380bb4fda62e8a17a030838d923b493f @wch wch committed Mar 12, 2013
Showing with 14 additions and 10 deletions.
  1. +7 −5 R/stat-summary.r
  2. +7 −5 man/stat_summary.Rd
View
@@ -65,14 +65,16 @@
#' stat_summary(fun.data=fun, colour="red", geom=geom, width=0.2, ...)
#' }
#'
-#' d + stat_sum_df("mean_cl_boot")
-#' d + stat_sum_df("mean_sdl")
-#' d + stat_sum_df("mean_sdl", mult=1)
-#' d + stat_sum_df("median_hilow")
+#' # The crossbar geom needs grouping to be specified when used with
+#' # a continuous x axis.
+#' d + stat_sum_df("mean_cl_boot", mapping = aes(group = cyl))
+#' d + stat_sum_df("mean_sdl", mapping = aes(group = cyl))
+#' d + stat_sum_df("mean_sdl", mult = 1, mapping = aes(group = cyl))
+#' d + stat_sum_df("median_hilow", mapping = aes(group = cyl))
#'
#' # There are lots of different geoms you can use to display the summaries
#'
-#' d + stat_sum_df("mean_cl_normal")
+#' d + stat_sum_df("mean_cl_normal", mapping = aes(group = cyl))
#' d + stat_sum_df("mean_cl_normal", geom = "errorbar")
#' d + stat_sum_df("mean_cl_normal", geom = "pointrange")
#' d + stat_sum_df("mean_cl_normal", geom = "smooth")
View
@@ -90,14 +90,16 @@ stat_sum_df <- function(fun, geom="crossbar", ...) {
stat_summary(fun.data=fun, colour="red", geom=geom, width=0.2, ...)
}
-d + stat_sum_df("mean_cl_boot")
-d + stat_sum_df("mean_sdl")
-d + stat_sum_df("mean_sdl", mult=1)
-d + stat_sum_df("median_hilow")
+# The crossbar geom needs grouping to be specified when used with
+# a continuous x axis.
+d + stat_sum_df("mean_cl_boot", mapping = aes(group = cyl))
+d + stat_sum_df("mean_sdl", mapping = aes(group = cyl))
+d + stat_sum_df("mean_sdl", mult = 1, mapping = aes(group = cyl))
+d + stat_sum_df("median_hilow", mapping = aes(group = cyl))
# There are lots of different geoms you can use to display the summaries
-d + stat_sum_df("mean_cl_normal")
+d + stat_sum_df("mean_cl_normal", mapping = aes(group = cyl))
d + stat_sum_df("mean_cl_normal", geom = "errorbar")
d + stat_sum_df("mean_cl_normal", geom = "pointrange")
d + stat_sum_df("mean_cl_normal", geom = "smooth")

0 comments on commit c980033

Please sign in to comment.