add sort feature for icicle chart
未關閉
還沒有人認領這個 Issue。
feature
P3
- 主要語言
- Python
- 星號
- 18.8k
- 分支
- 2.8k
- 平均合併
- 16 小時 26 分鐘
- 30 天內合併 PR
- 21
描述
I want to use icicle chart to show function call stacks, the MWE is as the following
import pandas as pd
import numpy as np
import plotly.express as px
data = np.array(
[
["main", "A-Func", None, 1],
["main", "C-Func", "sub1", 1],
["main", "C-Func", "sub2", 1],
["main", "B-Func", None, 1],
["main", "D-func", "sub1", 1],
["main", "D-func", "sub2", 1],
["main", "D-func", "sub3", 1],
]
)
df = pd.DataFrame(data, columns = ['Level0', 'Level1', 'Level2', 'Weight'])
fig = px.icicle(df, path=['Level0', 'Level1', 'Level2'], values='Weight')
fig.update_traces(root_color="lightblue")
fig.show()
This is yielding a graph sorted by both Weight and Name
If I added sort parameter
fig.update_traces(root_color="lightblue", sort=False)
The weight is not sorted, however the name are still sorted
What I want to achieve is the nature order of these function calls as I create the numpy object
main
|
+--- A-Func
|
+--- C-Func
| |
| +--- sub1
| |
| +--- sub2
|
+--- B-Func
|
+--- D-Func
|
+--- sub1
|
+--- sub2
|
+--- sub3
Is there some option I can use to achieve this?
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
使用 plotly.express.icicle 和 update_traces(sort=False),透過 pandas 和 NumPy 的 MWE 重現該問題。首先追蹤 icicle 圖表如何處理排序和階層結構順序;當某個選項能夠在不按權重或名稱排序的情況下保留函式呼叫及其子項目的輸入順序,並為所示範例加入 coverage 時,工作即完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- numpy, pandas, python
- 領域
- data-visualization
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100

