'How to make labels in boxplot vertical in R

I have too many labels on the x-axis. How can I project them vertically? I can't find the right arguments...

   boxplot(df$y$x, data=df, drop = TRUE, main = "Boxplot y vs x", ylab="y", xlab="x")

Hopefully someone can help me out. Thanks in advance.



Solution 1:[1]

Using ggplot2 you can do something like this

library(ggplot2)

ggplot(df) +
            geom_boxplot(aes(x = x,
                             y = y))+
            ggtitle("Boxplot y vs x") +
            theme(axis.text.x = element_text(angle = 90))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1