replicate ggplot2 text legend
未关闭
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
I'd like to create a legend having text over a point as in the ggplot2 example below. How can I replicate this with plotly. Doesn't need to be a nice and clean ggplotly() solution.
library(ggplot2)
library(plotly)
ds <- data.frame(text = c("+", "-"))
p <- ggplot(ds, aes(x = text, y = text, label = text)) +
geom_point(aes(colour = text), size = 6) +
geom_text(show.legend = TRUE) +
guides(colour = guide_legend(override.aes = list(label = c("-", "+")))) +
scale_colour_discrete(labels = c("minus", "plus"))
p
ggplotly(p)
ggplot2 version

ggplotly version

贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从提供的 ggplot2 和 ggplotly 示例开始,然后检查负责转换图例和文本轨迹的 plotly.R 代码。复现一个点上带有文本以及“minus”和“plus”等标签的图例;当 Plotly 结果在视觉上匹配所要求的 ggplot2 图例行为时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100