I want to add an inset pie chart at the bottom right of a bar chart.
The sample code are as follows:
import plotly.graph_objects as go
from plotly.subplots import make_subplots
fig = make_subplots(
rows=1, cols=1,
insets=[dict(
cell=(1,1),
type='domain',
l=0.5, w=0.5, h=0.5, b=0,
)],
)
fig.add_trace(go.Bar(
x=[2,3,4,5],
y=list('ABCD'),
orientation='h',
showlegend=False,
))
fig.add_trace(go.Pie(
values=[1,2,3],
labels=list('abc'),
showlegend=False,
))
However, the pie chart takes the full area. It seems that the parameter l
, w
, b
, h
in insets
do take effect. What I want is reduce the pie size so that it is located at the bottom right of the bar chart.
Thanks for any help!