【R】ggthemes
2021年4月15日
1. はじめに
ggthemes
は、ggplotのtheme, scale, geomの拡張パッケージです。
2. インストール
CRANからインストールできます。
install.packages("ggthemes")
3. つかってみる
まずは、ベースを準備。
library(ggplot2) library(ggthemes) p <- ggplot(mtcars, aes(disp, mpg, col= factor(gear))) + geom_point() + facet_wrap(~am)
そして、基本っぽいテーマを使ってみます。
p +theme_base()

こういうテーマもあります。
p+theme_calc()+scale_colour_calc()

エコノミストっぽいテーマ
p+theme_economist()+ scale_colour_economist()

比較的単純なテーマ。
geom_point()+theme_few()+scale_colour_few("dark")

なんか重い・・・。
p+theme_foundation()

ダークなテーマ。
p+theme_solarized(light=F)+scale_colour_solarized()

4. さいごに
他にもテーマがありますし、Scale, geomの機能もあります。ggplotの柔軟なカスタマイズ性に驚かされます。