我创建了以下代码来生成密度图,但是x轴的频率太大,即以2计。但是,我大多数数据的值都小于1,所以我希望能够更改x轴的频率。那可能吗?
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)
答案 0 :(得分:0)
添加一行:
scale_x_continuous(breaks = c(#'s, you, want), labels = c(labels, you, want))
在https://ggplot2.tidyverse.org/reference/scale_continuous.html上查看文档