plotly / plotly/plotly.py

Layer disappears if zoomed out. Reappears when zooming.

オープン
#2,811 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

Issue:
Objects will disappear if the zoom level of the graph is increased to a certain amount.

Demo:

  • image

  • Image 1: Zoomed out version of a graph

  • image

  • Image 2: Zoomed in version of the same graph

Specifications:
Plotly Version: 4.10.0

Code:

I included pickled versions of the buildable land / trackers objects here. They are geodataframes.

    # --- Set up base map ---
    fig = go.Figure(go.Scattermapbox())
    fig.update_layout(
        mapbox_accesstoken = token,
        mapbox_style = "mapbox://styles/skrhee/ckbtiaefh0wrr1hp7h4ya3zy4",
        mapbox_zoom = 13,
        mapbox_center = {'lon': centroid_lon, 'lat': centroid_lat},
        margin = {'l':0, 'r':0, 'b':0, 't':0},
        height = 500
        )
     
    layers = []
    # --- Add buildable polygons ---
    full_buildable = MultiPolygon(list(buildable_land['geometry']))
    obj = gd.GeoSeries(full_buildable).to_json()
    poly_json = json.loads(obj)
    
    layer = {
        'source': poly_json,
        'type': "fill",
        'below': "traces",
        'color': "royalblue",
        'opacity': 0.65
        }
    layers.append(layer)
    
    # --- Add tracker polygons ---
    trackers = gd.read_file(df['AL_0.0'][0])
    full_trackers = MultiPolygon(list(trackers['geometry']))
    obj = gd.GeoSeries(full_trackers).to_json()
    poly_json = json.loads(obj)
    
    layer = {
        'source': poly_json,
        'type': "fill",
        'below': "traces",
        'color': "royalblue",
        'opacity': 0.65
        }
    layers.append(layer)


    
    # --- Update Figure ---
    fig.update_layout(
        mapbox = {
            'layers': layers
            }
        )

    st.plotly_chart(fig, use_container_width=True)


[pickles.zip](https://github.com/plotly/plotly.py/files/5343508/pickles.zip)






コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、fig.update_layout で設定され、st.plotly_chart を通じてレンダリングされる mapbox layers で動作を再現します。提供されたコードと pickles を読み込める場合はそれらを使用して、ポリゴンレイヤーがズームレベルを変えても表示されたままになるか確認します。ズームアウトしてもレイヤーが消えなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
plotly, python
領域
data-visualization
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。