plotly / plotly/plotly.R

Implement geom_GeomPathInterpolate() so geom_link() from ggforce will work

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

还没有人认领这个 Issue。

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

描述

I created a ggplot with gradient line segments between points using geom_link2 from the ggforce package and it does what I want (pictured), but when I pipe it through ggplotly(), I get this warning Warning: geom_GeomPathInterpolate() has yet to be implemented in plotly. and it prints without the lines.

image

library(ggplot2)
library(plotly)
library(ggforce)

# df
data <- structure(list( Percent = c(0.32, 0.23, 0.75, 0.25, 0.482, 0.421, 0.5114, 0.3423, 0.27, 0.4324, 0.347, 0.377, 0.26, 
0.375, 0.18604, 0.241378, 0.3095, 0.348837209, 0.33333, 0.1875, 0.2820, 0.65, 0.72, 0.75, 0.81, 0.87, 0.8244),  date = structure(c(18262, 18293, 18322, 18353, 18383, 18414, 18444, 18475, 18506, 18536, 
18567, 18597, 18628, 18659, 18687, 18718, 18748, 18779, 18809, 18840, 18871, 18901, 18932, 18962, 18993, 19024, 19052), class = "Date")), row.names = c(NA, 
-27L), class = c("tbl_df", "tbl", "data.frame"))

# Create ggplot
test <- data %>% 
    ggplot( aes ( x = date, y = Percent,
                colour= Percent, 
                group = 1)) +   # Note sure why, but I have to add this
    geom_link2(  ) +
  geom_point ( ) + 
  scale_y_continuous(limits = c(0,1)) + 
  scale_colour_gradient2(low = "red", mid = "yellow" , high = "green", 
                         midpoint= 0.70,
                         limits = c(0,1)) 

# Looks good
test

# Prints warning/without line
test %>% plotly::ggplotly( ) 

贡献指南

打开贡献指南

从这里开始

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

调研方向

从不支持的入口点 geom_GeomPathInterpolate() 的 ggplotly() 转换路径入手,并使用提供的 geom_link2 示例重现该警告。跟踪 geom 的转换过程,然后验证渐变线能够在不产生警告的情况下渲染,同时保留现有点。

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

评估

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

把新 issue 发到你的邮箱

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