我明白geom_area是如何用来填充直线下的区域的。如何填充曲线下的区域,如geom_bspline创建的曲线
library("tidyverse")
library("ggforce")
dftest <- tibble(
x = c(1, 2, 3, 4, 5),
y = c(10, 15, 30, 80, 5)
)
# Fill area under straight lines - OK
ggplot(dftest, aes(x = x, y = y)) +
geom_point() +
geom_line() +
geom_area(alpha = 0.3)
# Fill area under curve ???
ggplot(dftest, aes(x = x, y = y)) +
geom_point() +
geom_bspline() 发布于 2019-10-07 06:08:26
您可以使用stat与区域geom配对:
ggplot(dftest, aes(x = x, y = y)) +
geom_point() +
stat_bspline(geom = "area", alpha = 0.3)

https://stackoverflow.com/questions/58262453
复制相似问题