Unrenderable violin plot
未关闭
还没有人认领这个 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!
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 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