plotly / plotly/plotly.py

px.scatter_3d, use case where color param affects size output

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

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

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

説明

I have created a scatter3d chart with plotly express. The scatter3d works fine with column "count" as size (fig 1). There are three big bubbles on the top layer and one on the bottom layer.

Image
fig1

I next add the color parameter to be a column "type" in the frame. The resulting plot appears to have incorrectly swapped out "count" for "type" in the size parameter, so now the actual size param is ignored and it maps color to size. (fig 2).

Image
fig2


import pandas as pd
import plotly.express as px

df = pd.DataFrame({
    "campaign": ["funny", "funny", "funny", "funny", "patriotic", "patriotic", "patriotic", "patriotic"],
    "product": ["classic", "classic", "diet", "diet", "classic", "classic", "diet", "diet"],
    "type": ["click", "land", "click", "land", "click", "land", "click", "land"],
    "count": [397, 108, 108, 411, 99, 410, 144, 323]
})

fig1 = px.scatter_3d(df, x="campaign", y="product", z="type", hover_data="count").update_traces({"marker": {"size": [j/10 for j in df["count"]]}})

fig2 = px.scatter_3d(df, x="campaign", y="product", z="type", hover_data="count", color="type").update_traces({"marker": {"size": [j/10 for j in df["count"]]}})

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

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

はじめの一歩

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

調査の方向性

まず、提供されている pandas と plotly.express px.scatter_3d の再現コードを実行し、update_traces 後の fig1 と fig2 を比較します。生成されたマーカーのサイズ値と色の値を調べ、color の追加によってサイズの出力が変わる理由を特定します。color="type" を指定した場合でも、カウントから導出されたマーカーサイズが有効なままであれば完了です。

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

評価

技術スタック
python
領域
data-visualization
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
68/100

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

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