Last active
August 29, 2015 14:25
-
-
Save kazutan/2edbb8b98bd332fc88c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lapplyでgeom_segment()を繰り返し記述 | |
p <- ggplot(iris, aes(y=Sepal.Width, x=Species)) + | |
stat_summary(fun.y=mean, geom = "bar") + | |
ylim(0,6) + | |
lapply(1:3, function(i) geom_segment(x=i-0.4, y=7-i, xend=i+0.4, yend=7-i)) | |
p | |
# あと教えてもらったmapply使ったサンプルコードメモ | |
q = ggplot(data.frame(x = c(-10, 10)), aes(x)) + | |
mapply(function(m, s, co) stat_function(fun = dnorm, args = list(mean = m, sd = s), colour = co), | |
-1:1, c(0.5, 1, 1.5), rainbow(3)) | |
q |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment