R 旋转x轴标签并更改ggplot2中的主题
有没有办法旋转ggplot中的x轴标签,同时更改主题 如果执行此操作,我可以旋转x轴标签:R 旋转x轴标签并更改ggplot2中的主题,r,ggplot2,R,Ggplot2,有没有办法旋转ggplot中的x轴标签,同时更改主题 如果执行此操作,我可以旋转x轴标签: ToothGrowth$dose <- as.factor(ToothGrowth$dose) ggplot(ToothGrowth, aes(x=dose, y=len)) + geom_boxplot() + theme(axis.text.x = element_text(angle = 90, hjust = 1)) ToothGrowth$dose这是因为顺序:theme\u
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
ggplot(ToothGrowth, aes(x=dose, y=len)) +
geom_boxplot() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
ToothGrowth$dose这是因为顺序:theme\u minimal
在theme
之后覆盖了后者。使用
ggplot(ToothGrowth, aes(x = dose, y = len)) +
geom_boxplot() + theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
给予
主题theme\u minimal
改变了很多事情,包括您使用theme
所做的更改。所以你应该用另一种方式来做:
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
ggplot(ToothGrowth, aes(x=dose, y=len)) +
geom_boxplot()
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
ToothGrowth$剂量
ToothGrowth$dose <- as.factor(ToothGrowth$dose)
ggplot(ToothGrowth, aes(x=dose, y=len)) +
geom_boxplot()
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +