Modify pre-defined ggplot2 theme

2019-08-18 22:49发布

问题:

I am using the following code to turn my x-axis legend by 90 degree:

theme(
    axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0)
)

Now I would like to use an existing theme, specifically theme_light() and keep my x-axis turned. Is there a way to modify just the axis.text.x property of theme_light() without needing to redefine the entire theme?

Solution

ggplot(...) +
theme_light() +
theme(
    axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0)
)
标签: r ggplot2