Skip to content

Commit 88c0458

Browse files
committed
fix gghdr
1 parent 83af42a commit 88c0458

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
16.3 KB
Loading

extension/gghdr.qmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@
1515
1. 多层箱体:普通箱线图(如 `geom_boxplot`)仅展示单一四分位数范围,而 HDR 箱线图通过 `prob` 参数展示多个概率层级,更直观反映数据密度分布。
1616
2. 模式线替代中位线:用众数(`mode`)替代传统中位数线,强调数据分布的峰值位置。
1717

18+
::: {.callout-warning}
19+
下面利用`gghdr`绘制HDR箱线图的代码在最新的 ggplot2 v3.5.1 中已经无法运行,这里使用`gghdr`官网上的图片进行展示。
20+
:::
21+
1822
```{r}
1923
#| label: gghdr
24+
#| eval: false
2025
2126
library(gghdr)
2227
library(ggplot2)
@@ -25,6 +30,8 @@ ggplot(faithful, aes(y = eruptions)) +
2530
theme_minimal()
2631
```
2732

33+
![](assets/README-gg_hdr-boxplot-1.png)
34+
2835
## 统计变换 stat
2936

3037
`gghdr`包使用`hdrcde`包来进行高度密度区域和条件密度的估计,通过自定义函数将估计结果转换成`ggplot2`能够使用的标准格式,省去了计算步骤。

0 commit comments

Comments
 (0)