简体   繁体   中英

Density plot - how to change frequency on x-axis

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM