无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

ggplot繪制山嵐圖

2023-08-27 15:28 作者:五柳冰冰  | 我要投稿

## 山嵐圖

```{r}
library(ggridges)
p <- ggplot(iris, aes(x = Sepal.Length, y = Species,fill=Species))

p+ geom_density_ridges(alpha=.5)

p+ geom_density_ridges2(alpha=.5)

p+ geom_density_ridges(alpha=.5,scale = 1)
p+ geom_density_ridges(alpha=.5,scale = 2)
p+ geom_density_ridges(alpha=.5,scale = .9)

```

按照x數(shù)值著色

```{r}
p1 <- ggplot(iris, aes(x = Sepal.Length, y = Species,fill=after_stat(x)))

p1 + geom_density_ridges_gradient(scale = 1)

p1 + geom_density_ridges_gradient(scale = 1)+scale_fill_viridis_c()

```

添加分位數(shù)的線

```{r}
p+stat_density_ridges(quantile_lines = TRUE, quantiles = c(0.025, 0.975), alpha = 0.7)

p+stat_density_ridges(quantile_lines = TRUE, quantiles = c(0.025, 0.975), alpha = 0.7,scale = 1)
```

按分位數(shù)的線分割著色

```{r}
ggplot(iris, aes(x=Sepal.Length, y=Species, fill = factor(stat(quantile)))) +
? stat_density_ridges(
??? geom = "density_ridges_gradient", calc_ecdf = TRUE,
??? quantiles = 4, quantile_lines = TRUE,
??? scale = 1) +
? scale_fill_viridis_d(name = "Quartiles")
```

按分位數(shù)的線分割著色2

```{r}
ggplot(iris, aes(x = Sepal.Length, y = Species, fill = factor(stat(quantile)))) +
? stat_density_ridges(
??? geom = "density_ridges_gradient",
??? calc_ecdf = TRUE,
??? quantiles = c(0.025, 0.975),
??? scale = 1 ) +
? scale_fill_manual(
??? name = "Probability", values = c("#FF0000A0", "pink", "pink"),
??? labels = c("(0, 0.025]", "(0.025, 0.975]", "(0.975, 1]")
? )
```
按概率密度值著色

```{r}
ggplot(iris, aes(x = Sepal.Length, y = Species, fill = 0.5 - abs(0.5 - stat(ecdf)))) +
? stat_density_ridges(geom = "density_ridges_gradient", calc_ecdf = TRUE,scale = 1) +
? scale_fill_viridis_c(name = "概率密度", direction = -1)
```


ggplot繪制山嵐圖的評論 (共 條)

分享到微博請遵守國家法律
常宁市| 湖南省| 桂东县| 镇远县| 瑞丽市| 兴文县| 当雄县| 肃南| 上思县| 稷山县| 灌南县| 黎平县| 宜兰县| 怀仁县| 玉屏| 锡林郭勒盟| 耒阳市| 新沂市| 海阳市| 临江市| 汝州市| 莱阳市| 革吉县| 宿松县| 攀枝花市| 桐柏县| 郸城县| 漯河市| 绥化市| 云浮市| 武穴市| 土默特右旗| 萍乡市| 剑河县| 潮安县| 逊克县| 陵水| 邢台县| 临湘市| 石家庄市| 二连浩特市|