plotly / plotly/plotly.R

Missing colors in heatmap if values are the identical

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

还没有人认领这个 Issue。

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

描述

Hello!
when creating a heatmap where values are all the same on a continuous scale, I get the expected colors from ggplot. However, when I put my ggplot into ggplotly, the colors are gone and it's all gray. Only happends, when values are identical. Happens with version 4.9.3 of plotly.

library(ggplot2)
library(dplyr)
library(plotly)

data <- tibble(hour = c(1, 1, 2, 2), day = c(1, 2, 1, 2), evaluation = c(1, 1, 1, 1))
g <- ggplot(data = data, mapping = aes(x = hour, y = day))
g <- g + geom_tile(aes(fill = evaluation), color = "white")
g <- g + scale_fill_gradientn(limits = c(0, 1), colours = c("red", "green"), name = "Availability")

print(g)         # ok, all colors are green as expected
print(ggplotly(g)) # not ok, colors in heatmap are gray, expected to be green

Please let me know if you need more explanation or additional information to track this down.

Thank you and kind regards,
Heiko

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 issue 中可复现的 R 示例开始,跟踪评估值完全相同的连续热力图的 ggplotly 转换过程。比较 ggplot 和 ggplotly 的输出,然后验证转换后的图块使用了预期的绿色,而不是灰色。

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

评估

技术栈
javascript, r
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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