Hello,
I would like to display two pie charts on the same level (row). I tried to use the following libraries
Blockquote
import plotly.graph_objects as go
from plotly.subplots import make_subplots
But without any successes⊠I keep receiving errors messages as I try to use the following pattern :
Blockquote
Create subplots: use âdomainâ type for Pie subplot
fig = make_subplots(rows=1, cols=2, specs=[[{âtypeâ:âdomainâ}, {âtypeâ:âdomainâ}]])
fig.add_trace(go.Pie(labels=labels, values=âQuantitĂ© de films ayant pour genre principalâ, name='genre),
1, 1)
fig.add_trace(go.Pie(labels=labels, values=âQuantitĂ© de films ayant pour genre secondaireâ, name='genre),
1, 2)
Use hole to create a donut-like pie chart
fig.update_traces(hole=.4, hoverinfo=âlabel+percent+nameâ)
fig.update_layout(
title_text=âTextâ,
# Add annotations in the center of the donut pies.
annotations=[dict(text=âmytextâ, x=0.18, y=0.5, font_size=20, showarrow=False),
dict(text=âmytext2â, x=0.82, y=0.5, font_size=20, showarrow=False)])
fig.show()
Hereâs a copy of the dataframe I used and the two consecutive pie charts I managed to get as single plots.


