Hi @clairew ,
Did you mean something like this :
You can create Scatter trace first .
Second step is create another figure object with make_subplots
to manage position of your pie chart inside previous scatter chart .
Add traces data from second figure (pie charts) into first figure (Scatter) by using add_traces
method.
import plotly.graph_objects as go
import numpy as np
from plotly.subplots import make_subplots
N = 1000
t = np.linspace(0, 50, 100)
y = np.sin(t)
fig = go.Figure(go.Scatter(x=t, y=y, mode='markers'))
labels = ["US", "China", "European Union", "Russian Federation", "Brazil", "India",
"Rest of World"]
fig1 = make_subplots(rows=2, cols=4, specs=[[{'type':'domain'}, {'type':'domain'}, {},{}],[{},{}, {},{}]])
fig1.add_trace(go.Pie(labels=labels, values=[16, 15, 12, 6, 5, 4, 42], name="GHG Emissions"),
1, 1)
fig1.add_trace(go.Pie(labels=labels, values=[27, 11, 25, 8, 1, 3, 25], name="CO2 Emissions"),
1, 2)
# Use `hole` to create a donut-like pie chart
fig1.update_traces(hole=.4, hoverinfo="label+percent+name")
fig.add_traces(fig1.data)
fig.update_layout(xaxis=dict(range=(0,50)),yaxis=dict(range=(0,2)))
fig.show()
or you can checkout this post, it seems relevant to your issue.
Hope this help.