Skip to content

Commit c980033

Browse files
committed
Fix stat_summary examples that use geom_crossbar. Fixes #775
1 parent ece6dcb commit c980033

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

R/stat-summary.r

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,16 @@
6565
#' stat_summary(fun.data=fun, colour="red", geom=geom, width=0.2, ...)
6666
#' }
6767
#'
68-
#' d + stat_sum_df("mean_cl_boot")
69-
#' d + stat_sum_df("mean_sdl")
70-
#' d + stat_sum_df("mean_sdl", mult=1)
71-
#' d + stat_sum_df("median_hilow")
68+
#' # The crossbar geom needs grouping to be specified when used with
69+
#' # a continuous x axis.
70+
#' d + stat_sum_df("mean_cl_boot", mapping = aes(group = cyl))
71+
#' d + stat_sum_df("mean_sdl", mapping = aes(group = cyl))
72+
#' d + stat_sum_df("mean_sdl", mult = 1, mapping = aes(group = cyl))
73+
#' d + stat_sum_df("median_hilow", mapping = aes(group = cyl))
7274
#'
7375
#' # There are lots of different geoms you can use to display the summaries
7476
#'
75-
#' d + stat_sum_df("mean_cl_normal")
77+
#' d + stat_sum_df("mean_cl_normal", mapping = aes(group = cyl))
7678
#' d + stat_sum_df("mean_cl_normal", geom = "errorbar")
7779
#' d + stat_sum_df("mean_cl_normal", geom = "pointrange")
7880
#' d + stat_sum_df("mean_cl_normal", geom = "smooth")

man/stat_summary.Rd

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,16 @@ stat_sum_df <- function(fun, geom="crossbar", ...) {
9090
stat_summary(fun.data=fun, colour="red", geom=geom, width=0.2, ...)
9191
}
9292

93-
d + stat_sum_df("mean_cl_boot")
94-
d + stat_sum_df("mean_sdl")
95-
d + stat_sum_df("mean_sdl", mult=1)
96-
d + stat_sum_df("median_hilow")
93+
# The crossbar geom needs grouping to be specified when used with
94+
# a continuous x axis.
95+
d + stat_sum_df("mean_cl_boot", mapping = aes(group = cyl))
96+
d + stat_sum_df("mean_sdl", mapping = aes(group = cyl))
97+
d + stat_sum_df("mean_sdl", mult = 1, mapping = aes(group = cyl))
98+
d + stat_sum_df("median_hilow", mapping = aes(group = cyl))
9799

98100
# There are lots of different geoms you can use to display the summaries
99101

100-
d + stat_sum_df("mean_cl_normal")
102+
d + stat_sum_df("mean_cl_normal", mapping = aes(group = cyl))
101103
d + stat_sum_df("mean_cl_normal", geom = "errorbar")
102104
d + stat_sum_df("mean_cl_normal", geom = "pointrange")
103105
d + stat_sum_df("mean_cl_normal", geom = "smooth")

0 commit comments

Comments
 (0)