まとめ一覧
補足:themeでX軸のラベルを回転させる
- themeでの個別設定が必要になる場合について解説します
table <- data.frame(
item_name = c("究極のマスクメロンアイスクリーム",
"イチゴたっぷりショートケーキイタリア風",
"和栗の贅沢ブラックモンブラン",
"朝どれ卵のなめらかプリン",
"マンゴーと南国フルーツのタルト",
"フルーツをたっぷりつかったロールケーキ"),
uriage_kosu = c(39,42,73,88,93,132)
)
ggplot(table) +
geom_bar(aes(item_name, uriage_kosu), stat="identity")
- このようにX軸が重なってしまったというときは、themeで設定を変えましょう
ggplot(table) +
geom_bar(aes(item_name, uriage_kosu), stat="identity") +
theme(axis.text.x = element_text(angle = 45, hjust=1))
- ただし、theme_classicなどを設定すると上書きされるので、
ggplot(table) +
geom_bar(aes(item_name, uriage_kosu), stat="identity") +
theme(axis.text.x = element_text(angle=45, hjust = 1)) +
theme_classic()
ggplot(table) +
geom_bar(aes(item_name, uriage_kosu), stat="identity") +
theme_classic() +
theme(axis.text.x = element_text(angle=45, hjust = 1))
まとめ一覧