Mapping alpha to continuous variable in geom_tile()/geom_raster()
未关闭
还没有人认领这个 Issue。
bug
ggplotly
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
I am trying to convert a heatmap I created with ggplot to a plotly object. Everything works fine, except no matter what I do, it won't translate the alpha values (I have tried both having it as aes- what I want- but also giving it a random value and it won't work. This is the ggplot code and output, which works fine:
I have tried both geom tile and geom raster and none of them seem to work.
plot <- datos%>%
ggplot(aes(Var2, Var1, fill = value, alpha = dum,
text = paste("<b>Edad:</b>", Var2, "<br>",
"<b>Año:</b>", Var1, "<br>",
"<b> Año de nacimiento: </b>", (Var1 - Var2), "<br>",
"<b>Renta relativa:</b>", format(value,
big.mark = ".",
scientific = FALSE,
digits = 2))))+
geom_raster()+
scale_alpha(range = c(0.6, 1))+
scale_x_continuous(breaks = seq(20, 75, by = 5), limits = c(20, 80))+
scale_y_continuous(breaks = seq(2008, 2016, by = 2 ), limits = c(2008, 2016))+
theme_minimal()
ggplot output (with a little more formatting:

ggplotly output (just doing ggplotly(plot)):

贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 ggplotly(plot) 重现所提供的示例,比较 geom_raster() 和 geom_tile(),以及映射的 alpha 值和固定的 alpha 值。跟踪 ggplotly 针对 alpha aesthetic 的转换路径,并将结果与原始 ggplot 输出进行核对。转换后的交互式热图能够保留连续 alpha 值即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100