I am plotting a graph with a categorical variable on the x axis and a numerical variable on the y axis.
For the x axis, given that there are many data points, the de
Another way to deal with overlapping labels is using guide = guide_axis(n.dodge = 2).
library(dplyr)
library(tibble)
library(ggplot2)
dt <- mtcars %>% rownames_to_column("name") %>%
dplyr::filter(cyl == 4)
# Overlapping labels
ggplot(dt, aes(x = name, y = mpg)) + geom_point()
ggplot(dt, aes(x = name, y = mpg)) + geom_point() +
scale_x_discrete(guide = guide_axis(n.dodge = 2))