3.7. 色を変えてみる
Open Colorというサイト(https://yeun.github.io/open-color/)を参考に色を指定してみました。
Mariのいろえんぴつというサイト(http://iroempitsu.net/)にも綺麗な色見本が揃っています。
RED_5 <- "#ff6b6b" ■ PINK_5 <- "#f06595" ■ GRAPE_5 <- "#cc5de8" ■ VIOLET_5 <- "#845ef7" ■ INDIGO_5 <- "#5c7cfa" ■ BLUE_5 <- "#339af0" ■ CYAN_5 <- "#22b8cf" ■ TEAL_5 <- "#20c997" ■ GREEN_5 <- "#51cf66" ■ LIME_5 <- "#94d82d" ■ YELLOW_5 <- "#fcc419" ■ ORANGE_5 <- "#ff922b" ■
# ggplot2 パッケージを使用 library(ggplot2) g <- ggplot(d) # ヒストグラムを描画 g <- g + geom_histogram( aes( x=d$"自チーム.10分あたりのTOUCH数", y=..density.., colour= d$"勝敗", fill=d$"勝敗" ), binwidth=5, alpha=0.1, position="identity" ) # 確率密度曲線を描画 g <- g + geom_density( aes( x=d$"自チーム.10分あたりのTOUCH数", y=..density.., colour= d$"勝敗", fill=d$"勝敗" ), stat = "density", position="identity", alpha=0.1 ) # ラグプロットを描画 g <- g + geom_rug( aes( d$"自チーム.10分あたりのTOUCH数", colour= d$"勝敗" ) ) # タイトルを変更 g <- g + labs(title="10分あたりのボールタッチ回数") g <- g + xlab("ボールタッチ") g <- g + ylab("確率密度") g <- g + labs(colour="凡例", fill="凡例") # テーマを指定 g <- g + theme_bw() # 色を指定 g <- g + scale_color_manual(values=c(GREEN_5, BLUE_5, PINK_5)) g <- g + scale_fill_manual( values=c(GREEN_5, BLUE_5, PINK_5)) print(g)