Reputation: 11
I created the below code to generate a density plot, however the frequency of the x axis is way too big ie it counts in 2's. However the value of most of my data is less that 1 so I want to be able to change the frequency of the x axis. Is that possible?
my_density_plot <- data.frame(Data = Data)
b <- ggplot(my_density_plot, aes(x=Data))+ labs(title = "Density test", y =
"Density")
b <- b + stat_density(geom = "line", alpha = 1, colour = "cornflowerblue")
print(b)
Upvotes: 1
Views: 1401
Reputation: 408
Add a line:
scale_x_continuous(breaks = c(#'s, you, want), labels = c(labels, you, want))
Check out the documentation at https://ggplot2.tidyverse.org/reference/scale_continuous.html
Upvotes: 1