PIB - GNU R - ggplot2
公式ページ等
ggplot2
参考になるページ等
Google:
ggplot2
Cédric Scherer / 2019-11-01:
A ggplot2 Tutorial for Beautiful Plotting in R
, ネタ元: twitter:
1199071632427339776
Hatena Blog / Triad sou. / 2010-05-28:
ggplot2 の自分用メモ集を作ろう
MrUnadon
/
ggplot2を初歩から要点押さえて使いこなす チュートリアルとコード集
Heavy Watal / R stats /
ggplot2 — きれいなグラフを簡単に合理的に
Tips
タイトル、キャプション
labs()
で title, subtitle, caption に与えた内容が表示される。
デフォルトではタイトルは左上、キャプションは右下に表示される。
ファセット
facetting
すると複数系列のデータを分離したグラフとして並べることが出来る。
facet_grid()
は与えた一つもしくは二つの変数でマトリクス状に配置し、
facet_wrap()
は一連の系列を m×n の領域に敷き詰めるという違いのようだ。
系列毎の stroke, fill 色
aes() で colour と fill に与えた項目毎に系列の stroke, fill カラーが決定される。
カラーテーブルの変更は、scale_colour_*(), scale_fill_*() で行う。
scale_{colour,fill}_brewer()
scale_{colour,fill}_continuous()
scale_{colour,fill}_gradient()
scale_{colour,fill}_gray()
scale_{colour,fill}_identity()
scale_{colour,fill}_manual()
scale_{colour,fill}_viridis_{c,d}()
なお、
Layer: geoms
の colour, fill に直接色指定した場合は、全系列が指定色で単色表示される。
参考:
stackoverflow / 2016-01-19:
Control bar border (color) thickness with ggplot2 stroke
関連
GNU R - ggplot2 - 横棒グラフ
GNU R
GNU R - graphics::plot