plotly / plotly/plotly.R

Unable to style colorbar in density mapbox

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

還沒有人認領這個 Issue。

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

描述

I am following the example given here: https://plotly.com/r/mapbox-density-heatmaps/

However, I am unable to change the color of the coloraxis (or use showscale = F or move the colorbar over on x).

The plot won't work unless coloraxis = 'coloraxis' is specified, and there doesn't seem to be a way to style the coloraxis.

# population density available from https://data.humdata.org/dataset/worldpop-population-density-for-haiti
pop_den <- read.csv(data_path)
plot_ly() %>% 
  add_trace(
    data = pop_den,  type = 'densitymapbox',  lat = ~Y,  lon = ~X,  z = ~Z,
    coloraxis = 'coloraxis',
    radius = 10) %>% 
  layout(
    mapbox = list(
      style = "carto-positron",
      zoom = 6.5,
      center = list(lon = -73.09, lat = 19.06),
      coloraxis = list(colorscale = "Grey", colorbar_x = 1.5)
      )
    )

image

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

首先,使用 issue 的程式碼重現 https://plotly.com/r/mapbox-density-heatmaps/ 中的 R densitymapbox 範例,並檢查如何處理 coloraxis 及其 layout 選項。完成標準是:可以依要求設定 coloraxis 的色彩、colorbar 的可見性和 colorbar 的位置,同時不會破壞繪圖。

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

評估

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

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

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