stat summary: add combined functions: fn_data: mean_sdl / mean_se

未关闭
#1,507 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
kotlin, python

调研方向

从 stat="summary" 的实现开始,跟踪 fn、fn_min 和 fn_max 的处理方式,然后检查现有的 summary 测试(如果有)。定义 mean_sdl 和 mean_se 的 fn_data 与 fn_args 组合行为,包括默认的 y、ymin 和 ymax aesthetics;当所提出的两个示例都产生预期的中心值和边界时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Stat summary can't produce the very common mean ± SD / SE chart (error bar / pointrange / ribbon). Its fn / fn_min / fn_max parameters take only point aggregations — count, sum, mean, median, min, max, lq, mq, uq — none of which express a spread-based interval.

What's missing is any spread-based bound (SD, SE). It's structurally different: ymin = mean − k·SD is not a single-column aggregation — it's derived jointly from the center and the dispersion of the same column, so it can't be modeled as an independent fn_min / fn_max, and there's currently no slot for it.

Proposed
Add a combined summary function parameter — the analog of ggplot2's fun.data — that returns center and bounds together as the computed variables ..y.., ..ymin.., ..ymax..:

  • fn_data="mean_sdl" — mean ± k·SD (ggplot2 default k = 2)
  • fn_data="mean_se" — mean ± k·SE

with a multiplier parameter (ggplot2 passes fun.args=list(mult=…)), e.g. fn_args={'mult': 1}. This is a new mechanism alongside fn / fn_min / fn_max (use one or the other), mirroring ggplot2's fun vs fun.data. Ideally stat="summary" + fn_data sets the default ymin/ymax aesthetics so they needn't be re-mapped.

Desirable API

# cleanest — the stat provides default y/ymin/ymax
geom_pointrange(data=df, stat="summary", fn_data="mean_sdl")                # mean ± 2·SD
geom_pointrange(data=df, stat="summary", fn_data="mean_se", fn_args={'mult': 1})

# explicit form (also valid, for control)
geom_pointrange(data=df, stat="summary", fn_data="mean_sdl",
                mapping=aes(y='..y..', ymin='..ymin..', ymax='..ymax..'))
主要语言
Kotlin
星标
1.8k
派生
63
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

JetBrains/lets-plot 的其他 Issue

查看 JetBrains/lets-plot 的全部 Issue

相似的 Issue

更多 Kotlin Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。