plotly / plotly/plotly.R

annotation_custom in ggplot not supported by plotly

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

还没有人认领这个 Issue。

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

描述


Hi all,
I have a line of code to draw a rectangle, with a gradient color scheme, onto a ggplot figure using annotation_custom. However, this is not supported (and does not appear) when I make my figure interactive with ggplotly.

I am having trouble finding another solution for making this same shape that appears in the static figure in the interactive figure. Is there a way that ggplotly can support custom annotations?
Thank you!

g <- rasterGrob(matrix(c(bluepal), nrow = 1), 
                                 width=unit(1,"npc"), height = unit(1,"npc"), 
                                 interpolate = TRUE) #make a gradient of blue colors 

annotation_custom(g, xmin=2.7, xmax=7.5, ymin=20, ymax=22)
<img width="379" alt="Screen Shot 2021-08-12 at 6 17 45 PM" src="https://user-images.githubusercontent.com/22037535/129281870-c665dea2-0c82-4818-86e2-24d311578342.png">


贡献指南

打开贡献指南

从这里开始

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

调研方向

首先使用 rasterGrob、annotation_custom 和 ggplotly 重现所提供的 R 示例,并比较静态 ggplot 与交互式结果。确定是否可以支持自定义注释,并验证渐变矩形是否出现在交互式图形中。

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

评估

技术栈
r
领域
data-visualization
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

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