R で ヒストグラム 箱ひげ図 ~少年サッカー データ分析~
得失点と、やや相関のみられた項目について、勝敗別のヒストグラム、箱ひげ図 を書いてみる
g <- ggplot(d4) g <- g + geom_histogram(aes(x=d4$"TOUCH比",fill=d4$"勝敗"), binwidth=2, alpha=0.2, position="identity") g <- g + scale_fill_manual(values = c("#00cc88", "#0000ff", "#ff00ff")) g <- g + xlab("自チームのタッチ数 / 自チームのタッチ数 + 相手チームのタッチ数") g <- g + ylab("試合数") print(g)
gbox <- ggplot(d4,aes(x=d4$"勝敗",y=d4$"TOUCH比",color=d4$"勝敗",fill=d4$"勝敗")) gbox <- gbox + geom_boxplot(color="black") gbox <- gbox + xlab("勝敗") gbox <- gbox + ylab("自チームのタッチ数 / 自チームのタッチ数 + 相手チームのタッチ数") plot(gbox)
g <- ggplot(d4) g <- g + geom_histogram(aes(x=d4$"KEEP比",fill=d4$"勝敗"), binwidth=2, alpha=0.2, position="identity") g <- g + scale_fill_manual(values = c("#00cc88", "#0000ff", "#ff00ff")) g <- g + xlab("自チームのキープ数 / 自チームのキープ数 + 相手チームのキープ数") g <- g + ylab("試合数") print(g)
gbox <- ggplot(d4,aes(x=d4$"勝敗",y=d4$"KEEP比",color=d4$"勝敗",fill=d4$"勝敗")) gbox <- gbox + geom_boxplot(color="black") gbox <- gbox + xlab("勝敗") gbox <- gbox + ylab("自チームのキープ数 / 自チームのキープ数 + 相手チームのキープ数") plot(gbox)
g <- ggplot(d4) g <- g + geom_histogram(aes(x=d4$"奪取",fill=d4$"勝敗"), binwidth=1, alpha=0.2, position="identity") g <- g + scale_fill_manual(values = c("#00cc88", "#0000ff", "#ff00ff")) g <- g + xlab("奪取") g <- g + ylab("試合数") print(g)
gbox <- ggplot(d4,aes(x=d4$"勝敗",y=d4$"奪取",color=d4$"勝敗",fill=d4$"勝敗")) gbox <- gbox + geom_boxplot(color="black") gbox <- gbox + xlab("勝敗") gbox <- gbox + ylab("奪取") plot(gbox)
意外と相関のみられなかった項目
g <- ggplot(d4) g <- g + geom_histogram(aes(x=d4$"パス",fill=d4$"勝敗"), binwidth=1, alpha=0.2, position="identity") g <- g + scale_fill_manual(values = c("#00cc88", "#0000ff", "#ff00ff")) g <- g + xlab("パス") g <- g + ylab("試合数") print(g) ggsave("パス.png")
gbox <- ggplot(d4,aes(x=d4$"勝敗",y=d4$"パス",color=d4$"勝敗",fill=d4$"勝敗")) gbox <- gbox + geom_boxplot(color="black") gbox <- gbox + xlab("勝敗") gbox <- gbox + ylab("パス") plot(gbox)
負の相関があると思ったのに、やや正の相関がある項目
g <- ggplot(d4) g <- g + geom_histogram(aes(x=d4$"保持の標準偏差",fill=d4$"勝敗"), binwidth=0.5, alpha=0.2, position="identity") g <- g + scale_fill_manual(values = c("#00cc88", "#0000ff", "#ff00ff")) g <- g + xlab("ボール保持の偏り") g <- g + ylab("試合数") print(g) ggsave("保持の標準偏差.png")
gbox <- ggplot(d4,aes(x=d4$"勝敗",y=d4$"保持の標準偏差",color=d4$"勝敗",fill=d4$"勝敗")) gbox <- gbox + geom_boxplot(color="black") gbox <- gbox + xlab("勝敗") gbox <- gbox + ylab("ボール保持の偏り") plot(gbox)