请看下面的图。
library(ggplot2)
dat <- data.frame(x = rnorm(1e6, sd = 0.01))
ggplot(data = dat, aes(x = x)) + geom_density() + ylim(0, 1) + xlim(-5, 5)
~密度> 0.2的密度曲线有相当一部分缺失。
有谁知道一个变通的办法吗?
你必须使用 coord_cartesian
以保留所有的基础数据点。
library(ggplot2)
dat <- data.frame(x = rnorm(1e6, sd = 0.01))
ggplot(data = dat, aes(x = x)) + geom_density() +
coord_cartesian(xlim = c(-5, 5), ylim = c(0, 1))
于2020-04-27创建。重读包 (v0.3.0)