散布図 + 折れ線グラフ
#Year列を各点の色(color)にマッピング
ggplot( data = d0, aes( x = 直接経費, y = 間接経費, color = Year ) ) +
geom_point( ) +
theme_gray( base_family = HiraKakuPro-W3 )
15.
散布図 + 折れ線グラフ
#geom_point内で色を指定
ggplot( data = d0, aes( x = 直接経費, y = 間接経費, color = Year ) ) +
geom_point( color = blue ) +
theme_gray( base_family = HiraKakuPro-W3 )
16.
散布図 + 折れ線グラフ
#折れ線グラフを追加
ggplot( data = d0, aes( x = 直接経費, y = 間接経費, color = Year ) ) +
geom_point( ) +
geom_line( ) +
theme_gray( base_family = HiraKakuPro-W3 )
17.
散布図 + 折れ線グラフ
#個別にaes()を指定
ggplot( data = d0, aes( x = 直接経費, y = 間接経費, color = Year ) ) +
geom_point( ) +
geom_line( aes( linetype = Year ) ) +
theme_gray( base_family = HiraKakuPro-W3 )
18.
散布図 + 折れ線グラフ
#個別にaes()を指定
ggplot( data = d0, aes( x = 直接経費, y = 間接経費, color = Year ) ) +
geom_point( aes( shape = Year ) ) +
geom_line( aes( linetype = Year ) ) +
theme_gray( base_family = HiraKakuPro-W3 )
19.
散布図 + 折れ線グラフ
#全体テーマの変更
ggplot( data = d0, aes( x = 直接経費, y = 間接経費, color = Year ) ) +
geom_point( aes( shape = Year ) ) +
geom_line( aes( linetype = Year ) ) +
theme_bw( base_family = HiraKakuPro-W3 )
20.
散布図 + 折れ線グラフ
#全体テーマの変更
ggplot( data = d0, aes( x = 直接経費, y = 間接経費, color = Year ) ) +
geom_point( aes( shape = Year ) ) +
geom_line( aes( linetype = Year ) ) +
theme_classic( base_family = HiraKakuPro-W3 )
21.
aes( )で指定できる要素
引数 内容
xx軸の値
y y軸の値
color 折れ線や点の色、枠線の色(棒)
fill 棒グラフの色
size 点の大きさ
shape 点の形
group 折れ線のグループ化
linetype 折れ線のタイプ
… …