Hi, What is the problem of using Figure_Factory in Figure_Objects

Hi

What is the problem of the below code?

import plotly.graph_objects as go
from plotly.figure_factory import create_quiver

fig=go.Figure()

fig.add_trace(go.FigureWidget(create_quiver(x=[0,0], y=[0,0], u=[1,4], v=[1,2])))

fig.show()

@bijan,
create_quiver returns an instance of go.Figure, let us say, qfig. Hence to add the arrows to another go.Figure, fig, you should write,

fig.add_trace(qfig.data[0])

qfig data[0] is an instance of go.Scatter.
Any function ff.create_something returns a fig. To see what contains fig.data, retrieve n = len( fig.data)
and then

for k in range(n):
       print(fig.data[k])
1 Like

Dear @empet

Really Thanks. You helped me in many other problems. Thank you so much bro.

I put the solve for any that may have the problem in future: (Solved again by @empet )

import plotly.graph_objects as go
from plotly.figure_factory import create_quiver

fig=go.Figure()

qfig=go.FigureWidget(create_quiver(x=[0,0], y=[0,0], u=[1,4], v=[1,2]))

fig.add_trace(qfig.data[0])

fig.show()