plotly / plotly/plotly.R

Opacity/alpha as attribute linked to a continuous variable

未關閉
#1,663 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
R
星號
2.7k
分支
641
PR 合併指標
30 天內沒有已合併 PR

描述

I am trying to get a continuous transparency according to a continuous variable that also defines the color. I've tried the code suggested in this post https://github.com/ropensci/plotly/issues/389 but I dont manage to do what I want and, in fact, I get very unexpected plots since the colorbar and marker's colors do not match + transparency seems the same for all colors.

require(plotly)
plot_ly(x = rnorm(100), y = rnorm(100), z = rnorm(100),
color = rbeta(100,shape1=1,shape2=1),alpha=.2,
type = "scatter3d", mode= "markers",
colors=colorRamp(c("blue","red")))

I'd like to get low transparency at high color values and vice versa. Is this possible in the currrent version of plot_ly?

plot_ly(x = rnorm(100), y = rnorm(100), z = rnorm(100),
color = rbeta(100,shape1=1,shape2=1),opacity=.2,
type = "scatter3d", mode= "markers",
colors=colorRamp(c("blue","red")))

setting opacity instead of alpha seems to fix the colouring vs colorbar but not the transparency issue.

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 issue 中可重現的 plot_ly scatter3d 範例開始,調查色彩、alpha 和不透明度如何映射到標記上。根據 colorbar 和標記的外觀驗證行為;當連續變數能夠依要求同時控制色彩和透明度,且色彩不會不相符時,即視為完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
r
領域
data-visualization
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。