plotly / plotly/plotly.py

Unrenderable violin plot

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

還沒有人認領這個 Issue。

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

描述

I have some example input here and a script for creating a violin plot. The plot writes without error but appears unrenderable, it never displays and will e.g., cause notebooks to crash.

Python 3.13.5
plotly 6.0.1
pandas 2.2.3
import pandas as pd
import plotly.express as px
from plotly.graph_objects import Figure


def create_plot(df: pd.DataFrame) -> Figure:
    fig = px.violin(
        df,
        color='sample',
        color_discrete_sequence=px.colors.qualitative.Safe,
        y='value',
        x='sample',
        points=False,
        box=True,
        facet_col='metric',
        facet_col_wrap=1,
    )
    fig.update_yaxes(matches=None)
    fig.update_xaxes(matches=None)
    fig.update_layout(height=400 * len(df['metric'].unique()))
    return fig


if __name__ == '__main__':
    file = 'df_melted.csv'
    df = pd.read_csv(file)
    fig = create_plot(df)
    fig.write_html('test_plot.html')

Example input file is attached. The input is admittedly unusual for a violin plot (essentially all 0s or all 1s).

Thanks in advance!

df_melted.csv

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

首先,在 Python 3.13.5 下使用附帶的 df_melted.csv 執行提供的 Python 指令碼,然後檢查 test_plot.html 並重現 notebook 當機。追蹤此輸入的 violin plot 渲染路徑;生成的 HTML 能夠正常渲染,且同一個圖形不再導致 notebooks 當機,即表示完成。

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

評估

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

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

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