Quantcast
Channel: Rotating x-axis labels and changing theme in ggplot2 - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Rotating x-axis labels and changing theme in ggplot2

$
0
0

Is there a way to rotate the x-axis labels in a ggplot plot AND change the theme at the same time?

If I do this, I can rotate the x-axis labels:

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))

But if I add a theme, the rotations won't work:

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)) +  theme_minimal()

I tried adding the rotation within the theme_minimal() function, but that didn't work either.

Thanks.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>