Skip to content

Instantly share code, notes, and snippets.

@Akiyah
Last active November 30, 2015 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Akiyah/9636973 to your computer and use it in GitHub Desktop.
Save Akiyah/9636973 to your computer and use it in GitHub Desktop.
スターバックスでトールサイズのタンブラーにショートサイズのホットコーヒーを入れてもらった記録をグラフにしてみた(2014-03-19)
data <- c(
404,468,449,435,421,438,432,453,400,425,486,410,401,
423,458,422,406,458,397,453,452,395,425,
361,466,368,460,363,509,414,439,
437,
385,442,406,402,371,429,402,453,389,413,412,481,
385,406,402,422,414,484,
441,434,408,392,447,388,362,418,429,437,415,387,401,406,441,393,395,419,407,417,444,395,429,371,413,458,410,420,404,416,391,422,385,398,403,405,392,397,483,533,433,440,391,422,472,378,400,508,401,445,414,446,416,389,400,550,453,394,413,379,426,457,368,426,403,415,418,448,416,464,408,443,371,432,438,404,398,393,389
)
data <- data - 189 # タンブラーの重さを除く
length(data)
mean(data)
sd(data)
library(ggplot2)
g <- ggplot(data.frame(value=data), aes(x=value))
g <- g + geom_histogram(binwidth=10)
g <- g + ggtitle("スターバックスで持参のトールタンブラーにショートを入れてもらったら")
g <- g + annotate("text",
label=paste0("サンプル:", length(data), ", 標準偏差:", round(sd(data), digits=1), "ml"),
x=220, y=10)
g <- g + geom_vline(xintercept=c(mean(data)), color="green")
g <- g + annotate("text",
label=paste0("平均=", round(mean(data), digits=1), "ml"),
x=mean(data), y=1, colour="green")
g <- g + geom_vline(xintercept=c(200), color="orange")
g <- g + annotate("text",
label="紙コップのショート=約200ml",
x=200, y=0.5, colour="orange")
plot(g)
ggsave(file="starbucks.png", plot=g, dpi=100, width=8, height=8)
data <- c(
404,468,449,435,421,438,432,453,400,425,486,410,401,
423,458,422,406,458,397,453,452,395,425,
361,466,368,460,363,509,414,439,
437,
385,442,406,402,371,429,402,453,389,413,412,481,
385,406,402,422,414,484,
441,434,408,392,447,388,362,418,429,437,415,387,401,406,441,393,395,419,407,417,444,395,429,371,413,458,410,420,404,416,391,422,385,398,403,405,392,397,483,533,433,440,391,422,472,378,400,508,401,445,414,446,416,389,400,550,453,394,413,379,426,457,368,426,403,415,418,448,416,464,408,443,371,432,438,404,398,393,389,
401,399,394,467,416,398,391,430,445,411,426,413,401,420,441,419,370,497,450,373,529,411,393,451,473,443,420,391,543,404,416,469,423,424,410,419,412,524,437,416,542,405,400,442,394,435,474,404,416,514,462,400,466,479,430,391,508,425,403,401,427,437,399,460,372,418,479,381,437,406,407,437,405,401,395,406,410,465,431,441,409,448,404,381,442,430,371,413,507,421,426,456,441,441,531,401,414,480,405,409,438,422,420,431,413,416,454,400,484,410,366,417,402,393,472,414,429,420,425,418,455,408,454,385,405,448,404,462,460,410,521,406,431,447,433,419,457,401,463,416,395,416,427,452,438,426,498,426,460,383,474,407,429,442,419,412,543,376,389,451,445,447,398,380,403,450,447,403,395,375,435,467,464,450,436,398,421,513,486,404,383,447,463,437,446,435,412,381,427,419,327,413,433,440,433,390,442,441,382,445,389,417,427,408,398,498,439,316,409,447,407,435,411,446,401,417,440,385,403,478,406,492,396,344,489,426,513,445,493,368,458,462,418,435
)
data <- data - 189 # タンブラーの重さを除く
length(data)
mean(data)
sd(data)
library(ggplot2)
g <- ggplot(data.frame(value=data), aes(x=value))
g <- g + geom_histogram(binwidth=10)
g <- g + ggtitle("スターバックスで持参のトールタンブラーにショートを入れてもらったら")
g <- g + annotate("text",
label=paste0("サンプル:", length(data), ", 標準偏差:", round(sd(data), digits=1), "ml"),
x=220, y=10)
g <- g + geom_vline(xintercept=c(mean(data)), color="green")
g <- g + annotate("text",
label=paste0("平均=", round(mean(data), digits=1), "ml"),
x=mean(data), y=2, colour="green")
g <- g + geom_vline(xintercept=c(200), color="orange")
g <- g + annotate("text",
label="紙コップのショート=約200ml",
x=200, y=0.5, colour="orange")
plot(g)
ggsave(file="starbucks.png", plot=g, dpi=100, width=8, height=8)
data <- c(
404,468,449,435,421,438,432,453,400,425,486,410,401,
423,458,422,406,458,397,453,452,395,425,
361,466,368,460,363,509,414,439,
437,
385,442,406,402,371,429,402,453,389,413,412,481,
385,406,402,422,414,484,
441,434,408,392,447,388,362,418,429,437,415,387,401,406,441,393,395,419,407,417,444,395,429,371,413,458,410,420,404,416,391,422,385,398,403,405,392,397,483,533,433,440,391,422,472,378,400,508,401,445,414,446,416,389,400,550,453,394,413,379,426,457,368,426,403,415,418,448,416,464,408,443,371,432,438,404,398,393,389,
401,399,394,467,416,398,391,430,445,411,426,413,401,420,441,419,370,497,450,373,529,411,393,451,473,443,420,391,543,404,416,469,423,424,410,419,412,524,437,416,542,405,400,442,394,435,474,404,416,514,462,400,466,479,430,391,508,425,403,401,427,437,399,460,372,418,479,381,437,406,407,437,405,401,395,406,410,465,431,441,409,448,404,381,442,430,371,413,507,421,426,456,441,441,531,401,414,480,405,409,438,422,420,431,413,416,454,400,484,410,366,417,402,393,472,414,429,420,425,418,455,408,454,385,405,448,404,462,460,410,521,406,431,447,433,419,457,401,463,416,395,416,427,452,438,426,498,426,460,383,474,407,429,442,419,412,543,376,389,451,445,447,398,380,403,450,447,403,395,375,435,467,464,450,436,398,421,513,486,404,383,447,463,437,446,435,412,381,427,419,327,413,433,440,433,390,442,441,382,445,389,417,427,408,398,498,439,316,409,447,407,435,411,446,401,417,440,385,403,478,406,492,396,344,489,426,513,445,493,368,458,462,418,435,
453,437,441,453,469,405,457,421,456,460,442,435,408,416,454,439,402,462,464,401,425,463,450,480,453,493,428,446,450,453,447,423,439,461,414,456,438,451,426,440,419,448,420,406,446,443,467,430,413,440,432,475,424,425,445,446,414,432,424,442,418,445,484,458,460,507,437,440,481,445,449,452,401,407,469,423,422,432,422,412,431,458,518,403,449,357,463,423,435,474,434,399,456,464,426,428,469,403,441,421,455,407,418,448,442,413,435,433,433,465,435,429,424,528,441,466,460,431,422,441,436,472,440,398,449,429,418,432,447,493,459,440,472,466,459,444,438,421,430,474,458,465,432,424,425,444,452,456,455,436,413,431,432,441,455,452,423,443,429,432,460,428,433,543,432,384,435,442,456,417,410,432,425,443,439,426,438,399,451,425,440,440,522,537,432,408,462,457,425,451,435,450,411,425,476,438,433,444,423,443,478,466,508,427,459,423,463,433,463,405,453,442,481,446,465,435,429,458,420,470,545,443,423,441,411,445,454,452,444,464,435,418,443,472,448,412,449,478,435,407,453,471,447,451,429,423,476,460,439,448,512,467,442,436,456,399,437,386,446,431,430,457,394,422,462,403,448,439,426,413,411,429,443,440,428,438,482,447,453,458,388,441,433,436,428,465,405,423,412,450,534,428,425,513,461,367,441,427,448,432,404,459,480,441,427,449,478,424,441,450,502,440,444,486,453,443,444,416,458,453,408,471,435,451,403,421,425,401,403,454,488,453,429,421,416,422,438,442,409,465,470,395,432,387,425,399,515,461,466,438,421,404,468,446,437,488,445,436,422,433,439,453,472,418,414,428,427,477,397,428,427,463,441,464,435,420,402,390,425,432,418,434,461,402,450,384,460,389,451,403,452,417,467,429,443,460,477,428,439,429,463,411,462,429,448,473,373,404,353,436,469
)
data <- data - 189 # タンブラーの重さを除く
length(data)
mean(data)
sd(data)
library(ggplot2)
g <- ggplot(data.frame(value=data), aes(x=value))
g <- g + geom_histogram(binwidth=10)
g <- g + ggtitle("スターバックスで持参のトールタンブラーにショートを入れてもらったら")
g <- g + annotate("text",
label=paste0("サンプル:", length(data), ", 標準偏差:", round(sd(data), digits=1), "ml"),
x=220, y=23)
g <- g + geom_vline(xintercept=c(mean(data)), color="green")
g <- g + annotate("text",
label=paste0("平均=", round(mean(data), digits=1), "ml"),
x=mean(data), y=10, colour="green")
g <- g + geom_vline(xintercept=c(200), color="orange")
g <- g + annotate("text",
label="紙コップのショート=約200ml",
x=200, y=5, colour="orange")
plot(g)
ggsave(file="starbucks.png", plot=g, dpi=100, width=8, height=8)
data <- c(
404,468,449,435,421,438,432,453,400,425,486,410,401,
423,458,422,406,458,397,453,452,395,425,
361,466,368,460,363,509,414,439,
437,
385,442,406,402,371,429,402,453,389,413,412,481,
385,406,402,422,414,484,
441,434,408,392,447,388,362,418,429,437,415,387,401,406,441,393,395,419,407,417,444,395,429,371,413,458,410,420,404,416,391,422,385,398,403,405,392,397,483,533,433,440,391,422,472,378,400,508,401,445,414,446,416,389,400,550,453,394,413,379,426,457,368,426,403,415,418,448,416,464,408,443,371,432,438,404,398,393,389,
401,399,394,467,416,398,391,430,445,411,426,413,401,420,441,419,370,497,450,373,529,411,393,451,473,443,420,391,543,404,416,469,423,424,410,419,412,524,437,416,542,405,400,442,394,435,474,404,416,514,462,400,466,479,430,391,508,425,403,401,427,437,399,460,372,418,479,381,437,406,407,437,405,401,395,406,410,465,431,441,409,448,404,381,442,430,371,413,507,421,426,456,441,441,531,401,414,480,405,409,438,422,420,431,413,416,454,400,484,410,366,417,402,393,472,414,429,420,425,418,455,408,454,385,405,448,404,462,460,410,521,406,431,447,433,419,457,401,463,416,395,416,427,452,438,426,498,426,460,383,474,407,429,442,419,412,543,376,389,451,445,447,398,380,403,450,447,403,395,375,435,467,464,450,436,398,421,513,486,404,383,447,463,437,446,435,412,381,427,419,327,413,433,440,433,390,442,441,382,445,389,417,427,408,398,498,439,316,409,447,407,435,411,446,401,417,440,385,403,478,406,492,396,344,489,426,513,445,493,368,458,462,418,435,
453,437,441,453,469,405,457,421,456,460,442,435,408,416,454,439,402,462,464,401,425,463,450,480,453,493,428,446,450,453,447,423,439,461,414,456,438,451,426,440,419,448,420,406,446,443,467,430,413,440,432,475,424,425,445,446,414,432,424,442,418,445,484,458,460,507,437,440,481,445,449,452,401,407,469,423,422,432,422,412,431,458,518,403,449,357,463,423,435,474,434,399,456,464,426,428,469,403,441,421,455,407,418,448,442,413,435,433,433,465,435,429,424,528,441,466,460,431,422,441,436,472,440,398,449,429,418,432,447,493,459,440,472,466,459,444,438,421,430,474,458,465,432,424,425,444,452,456,455,436,413,431,432,441,455,452,423,443,429,432,460,428,433,543,432,384,435,442,456,417,410,432,425,443,439,426,438,399,451,425,440,440,522,537,432,408,462,457,425,451,435,450,411,425,476,438,433,444,423,443,478,466,508,427,459,423,463,433,463,405,453,442,481,446,465,435,429,458,420,470,545,443,423,441,411,445,454,452,444,464,435,418,443,472,448,412,449,478,435,407,453,471,447,451,429,423,476,460,439,448,512,467,442,436,456,399,437,386,446,431,430,457,394,422,462,403,448,439,426,413,411,429,443,440,428,438,482,447,453,458,388,441,433,436,428,465,405,423,412,450,534,428,425,513,461,367,441,427,448,432,404,459,480,441,427,449,478,424,441,450,502,440,444,486,453,443,444,416,458,453,408,471,435,451,403,421,425,401,403,454,488,453,429,421,416,422,438,442,409,465,470,395,432,387,425,399,515,461,466,438,421,404,468,446,437,488,445,436,422,433,439,453,472,418,414,428,427,477,397,428,427,463,441,464,435,420,402,390,425,432,418,434,461,402,450,384,460,389,451,403,452,417,467,429,443,460,477,428,439,429,463,411,462,429,448,473,373,404,353,436,469,
423,492,448,424,422,452,438,452,436,455,455,431,494,448,502,482,443,450,450,439,437,503,453,402,417,433,423,441,472,458,451,460,461,481,426,452,424,350,475,418,447,423,508,499,451,443,468,429,399,439,366,419,425,425,423,403,442,440,440,457,403,458,412,442,424,456,492,417,440,461,461,554,409,526,453,437,457,422,422,440,417,421,444,430,449,478,439,431,395,446,439,436,450,453,527,418,400,444,437,455,423,443,459,426,421,431,395,433,426,497,395,434,443,454,421,415,449,474,445,459,433,447,423,443,431,488,448,434,461,461,444,466,447,422,428,435,431,441,458,430,432,462,451,480,428,544,458,454,451,435,428,457,456,464,456,439,445,444,486,473,425,436,437,470,415,408,424,421,442,457,424,431,481,431,478,441,462,443,454,427,414,437,422,448,542,464,421,459,452,440,487,440,424,428,416,427,450,412,448,442,461,437,452,465,449,425,468,482,460,460,432,396,457,451,461,451,465,396,465,460,433,482,447,451,451,454,404,484,461,452
)
data <- data - 189 # タンブラーの重さを除く
length(data)
mean(data)
sd(data)
library(ggplot2)
g <- ggplot(data.frame(value=data), aes(x=value))
g <- g + geom_histogram(binwidth=10)
g <- g + ggtitle("スターバックスで持参のトールタンブラーにショートを入れてもらったら")
g <- g + annotate("text",
label=paste0("サンプル:", length(data), ", 標準偏差:", round(sd(data), digits=1), "ml"),
x=220, y=23)
g <- g + geom_vline(xintercept=c(mean(data)), color="green")
g <- g + annotate("text",
label=paste0("平均=", round(mean(data), digits=1), "ml"),
x=mean(data), y=10, colour="green")
g <- g + geom_vline(xintercept=c(200), color="orange")
g <- g + annotate("text",
label="紙コップのショート=約200ml",
x=200, y=5, colour="orange")
plot(g)
ggsave(file="starbucks.png", plot=g, dpi=100, width=8, height=8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment