Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Unrenderable violin plot #5261

Open
Open
Labels
P2considered for next cycle bugsomething broken
@slambert-git

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2considered for next cycle bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /