Add support for ggrepel::geom_text_repel labels
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
I would like to produce a scatter plot in HTML format where labels are associated with each point.
This works well when I export the plot in PDF or PNG format:
But my HTML does not have the labels associated with each point. The warning message suggests that plotly does not support the label geometry from the ggrepel package:
Would someone be so kind so add support for this function, please?
data(iris)
library(ggplot2)
library(htmlwidgets)
library(plotly)
p <- ggplot2::ggplot(iris, ggplot2::aes(x = Sepal.Length, y = Petal.Length)) +
ggplot2::geom_point() +
ggrepel::geom_text_repel(ggplot2::aes(label = Species)) +
ggplot2::theme_classic()
ggplot2::ggsave('output/plot/point/example_repel_labels.pdf', p, height = 15, width = 15)
ggplot2::ggsave('output/plot/point/example_repel_labels.png', p, height = 15, width = 15)
pPlotly <- plotly::ggplotly(p)
htmlwidgets::saveWidget(pPlotly, 'output/plot/point/example_repel_labels.html')
Output:
Warning message:
In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomTextRepel() 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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从警告中提到的 geom2trace.default 入口点开始,使用 geom_text_repel 重现所提供的 R 示例。当 plotly::ggplotly 在保存的 HTML 中渲染出标签,且未报告不支持 GeomTextRepel 时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100