plotly / plotly/plotly.R

Implement geom_GeomFunction()

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

还没有人认领这个 Issue。

主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述

I am running an R shiny app that uses plotly. One of the plots includes a distribution drawn using stat_function, which works great with ggplot(), but that dissapears when the ggplot object is passed to plotly::ggplotly(), returning the following message:

Warning message:
In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomFunction() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues

Please, follow the reproducible example below, using the attached file (see below) as input:

library("plotly")
library("tidyverse")
df <- readr::read_csv("effect.csv")
my_plot <- df %>% ggplot2::ggplot() +
    stat_bin(aes(x=effect, y=..density..), fill="blue", colour="white", binwidth = 0.02) +
    stat_function(aes(x = effect, y = ..y..), fun = get("dlnorm"), colour="red", n = 100, args = c(-3.3, 0.5)) +
    scale_x_continuous(name = "Effect size") +
    scale_y_continuous(name = "", limits = c(0, 25))
    theme_minimal()
# ggplot (with the red line showing the distribution fit)
my_plot
# plotly version (without the line, and returning the above message)
plotly::ggplotly(my_plot)

Example file with effect.csv:
example.zip

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 plotly::ggplotly() 产生的 geom2trace.default 警告开始,使用提供的 R 示例和 effect.csv 文件重现该警告。比较使用 dlnorm 的 stat_function 在 ggplot 和 plotly 中的输出。完成标准是:分布线出现在 plotly 输出中,并且未实现 geom 警告消失。

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

评估

技术栈
r
领域
data-visualization
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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