plotly / plotly/plotly.R

ColorScale Will Not Change If Specifying with colorscale = c('hexcode1', 'hexcode2')

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

还没有人认领这个 Issue。

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

描述

Hi,

After following the guide here, https://plotly.com/r/3d-scatter-plots/, I found that, when specifying color scale with colorscale = c('hexcode1', 'hexcode2') will not have changes to the color scale, yet the default palette names such as 'Rainbow' will work. In this case, it would not be possible to self-define the 2 end points of the color scale. Please feel free to run the R codes below to see what I mean.


library(dplyr)
library(plotly)

fig <- plot_ly(mtcars, x = ~wt, y = ~hp, z = ~qsec,
               marker = list(color = ~mpg, 
                             #colorscale = c('#FF0000', '#00FF72'), 
                             #colorscale ='Rainbow',
                             colorscale = c('#132B43', '#56B1F7'),
                             showscale = TRUE))
fig <- fig %>% add_markers()
fig <- fig %>% layout(scene = list(xaxis = list(title = 'Weight'),
                                   yaxis = list(title = 'Gross horsepower'),
                                   zaxis = list(title = '1/4 mile time')),
                      annotations = list(
                        x = 1.13,
                        y = 1.05,
                        text = 'Miles/(US) gallon',
                        xref = 'paper',
                        yref = 'paper',
                        showarrow = FALSE
                      ))
fig

Just wondering if this is a bug or may be there needs some updates to the guide?

Thanks,

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先运行 3D 散点图指南中提供的 R 示例,并将自定义十六进制 colorscale 与正常工作的 Rainbow 调色板进行比较。跟踪 colorscale 如何通过 plot_ly() 和 add_markers() 传递。完成的标准是:指定的两个端点颜色能够明显控制 marker 的 colorscale,或者指南记录受支持的语法。

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

评估

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

把新 issue 发到你的邮箱

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