Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.7k
Open
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.5plotly 6.0.1pandas 2.2.3
import pandas as pdimport plotly.express as pxfrom plotly.graph_objects import Figuredef 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 figif __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!