相关疑难解决方法(0)

如何在ggplot2 R图中设置轴的限制?

我绘制以下内容:

library(ggplot2)    

carrots <- data.frame(length = rnorm(500000, 10000, 10000))
cukes <- data.frame(length = rnorm(50000, 10000, 20000))
carrots$veg <- 'carrot'
cukes$veg <- 'cuke'
vegLengths <- rbind(carrots, cukes)

ggplot(vegLengths, aes(length, fill = veg)) +
 geom_density(alpha = 0.2)
Run Code Online (Sandbox Code Playgroud)

现在说我只是想绘制之间的区域x=-50005000,而不是整个范围.

我怎样才能做到这一点?

plot r ggplot2

336
推荐指数
2
解决办法
55万
查看次数

标签 统计

ggplot2 ×1

plot ×1

r ×1