Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Unrenderable violin plot

未关闭
#5,261 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
pandas, plotly, python

调研方向

首先,在 Python 3.13.5 下使用附带的 df_melted.csv 运行提供的 Python 脚本,然后检查 test_plot.html 并复现 notebook 崩溃。跟踪此输入的 violin plot 渲染路径;生成的 HTML 能够正常渲染,并且同一个图形不再导致 notebooks 崩溃,即表示完成。

由索引模型根据 Issue 内容生成。

描述

bug P2

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

主要语言
Python
星标
18.8k
派生
2.8k
平均合并
13 小时 41 分钟
30 天内合并 PR
21

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

plotly/plotly.py 的其他 Issue

查看 plotly/plotly.py 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。