I have about four figurs I have plotted with plotly, now I will like to take those figures and make a subplot with them. Following the plotly docs here: https://plotly.com/python/subplots/ I get an error that an invalid data. for the sake of illustration, I have shown two figures here below and my attempt below. Kindly advise how to fix this
My first plotly graph below:
# create an empty figure
fig = go.Figure()
hor_dist = confg['hor'].values
ver_dist = confg['ver'].values
# update the x and y axis
fig.update_xaxes(range=[np.min(hor_dist)-2, np.max(hor_dist)+2])
fig.update_yaxes(range=[np.min(ver_dist)-2, np.max(ver_dist)+2])
fig.update_xaxes(zeroline=True, zerolinewidth=3, zerolinecolor='Black')
fig.update_yaxes(zeroline=True, zerolinewidth=3, zerolinecolor='Black')
fig.add_trace(go.Scatter(x =hor_dist,
y=ver_dist,
mode='markers',
marker_size=30,
line = dict(color='grey', width=1)))
fig.add_trace(go.Scatter(x =[cot_hor[-2], cot_hor[-1]],
y=[cot_ver[-2], cot_ver[-1]],
name='CoT',
mode='markers',
marker_size=30,
line = dict(color='green', width=1)))
My second figure below:
import numpy as np
from numpy import pi, sin, cos
import plotly.graph_objects as go
fig1 = go.Figure(go.Scatter())
radius =50
offset = df_LTM1['yaw_art'].max()
fig1.update_xaxes(range=[-60, 60])
fig1.update_yaxes(range=[-60, 60])
fig1.add_shape(type="circle",
xref="x",
yref="y",
x0=-radius,
y0=-radius,
x1=radius,
y1=radius,
fillcolor='green'
)
fig1.add_shape(type="circle",
xref="x",
yref="y",
x0=df_LTM1['yaw_art'].iloc[-2] - radius - offset,
y0=df_LTM1['pitch_art'].iloc[-2]-radius - offset,
x1=df_LTM1['yaw_art'].iloc[-1] + radius + offset,
y1=df_LTM1['pitch_art'].iloc[-1] + radius + offset,
)
fig1.update_xaxes(scaleratio=1, scaleanchor='y')
Now trying to create a subplot using
from plotly.subplots import make_subplots
final_fig = make_subplots(rows=2, cols=2)
final_fig.append_trace(fig1, row=1, col=1)
Gives me an error of ValueError: Invalid element(s) received for the βdataβ property of Invalid elements include