*disclaimer
1196940
theme()
- グラフの調整
g <- ggplot(tmp)
g <- g + aes(x=文長, y=value, color=name)
g <- g + geom_point()
g <- g + geom_smooth(method="lm")
g <- g + labs(title="MHD vs. KJ", # タイトル
x = "文長 (sentence length)", # x軸名
y = "Index Value", # y軸名
color="指標" # 凡例の見出し
)
g <- g + theme(aspect.ratio=1, # 全体の縦横比
title=element_text(size=20), # タイトルの文字サイズ
axis.title=element_text(size=18), # 軸名の文字サイズ
axis.text=element_text(size=12), # 軸目盛の文字サイズ
legend.text=element_text(size=12), # 凡例の文字サイズ
#legend.position = "top", # 凡例の位置(図の上)
legend.justification = "top" # 凡例の位置(上揃え)
)
g <- g + scale_color_discrete(labels=c("KJ", "MHD")) # 凡例の項目変更
plot(g)
Tips
パネル
panel.background=element_rect(fill="white"), panel.grid.major=element_line(color="grey80"), panel.border = element_rect(color="black", fill=NA)
https://sugiura-ken.org/wiki/