plotly / plotly/plotly.py

`fitbounds="locations"` parameter not working for `px.choropleth_map`

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

還沒有人認領這個 Issue。

bug P3 size: 1
主要語言
Python
星號
18.8k
分支
2.8k
平均合併
16 小時 26 分鐘
30 天內合併 PR
21

描述

The fitbounds parameter appear not to work when used in choropleth mapbox. The only way I found to pass it to the Figure object was to use the update_geos method.

The following is a sample of the code to show the parameter used:

fig = px.choropleth_mapbox(
        df, 
        geojson=self.geojson,
        featureidkey=self.featureidkey,
        locations="location_code,
        color=self.metric,
        mapbox_style="carto-positron",
        opacity=0.4
    )
fig.update_geos(fitbounds="locations")

When calling fig.show, the plot opens to the (0,0) location in Gulf of Guinea.

Why the fitbounds parameter doesn't work on choropleth mapbox?

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

先重現提供的 px.choropleth_mapbox 範例,並檢查 choropleth_mapbox 與 update_geos 如何處理 fitbounds。追蹤 figure 生成的進入點,並確認地圖是以提供的位置為中心,而不是以 (0,0) 為中心;針對該行為記錄一項專門的回歸檢查。

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

評估

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

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

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