R !!!ggplot2 !基本:グラフの部品を重ねていく *ggplot(データ) **aes でグラフの要素の指定 *geom_point で散布図 *geom_smooth で回帰線 *theme で見た目の設定 ggplot(data, aes(x=x軸, y=y軸)) + geom_point() + geom_smooth()+ theme_bw() {{pre > ggplot(shadow.tidy2, aes(x=Score, y=Ctest)) + + geom_point() + + geom_smooth() + + theme_bw() `geom_smooth()` using method = 'loess' and formula 'y ~ x' > }} {{ref_image Score-Ctest.png}} !geom_ *geom_point() 散布図 *geom_histogram() ヒストグラム *geom_line() 折れ線グラフ *geom_violin() バイオリンプロット *geom_boxplot() 箱ひげ図 !theme_ *theme_bw() 白黒 *theme_classic() クラシック !積み重ねの各段階を保存して、そこまでの出力をする {{pre step1 <- ggplot(data, aes()) step2 <- step1 + geom_point() step3 <- step2 + geom_smooth() step4 <- step3 + theme_classic() print(step4) }}