Hi! Can anyone spot an error in the following code? The idea is to animate a camera fly above some surface. The code seems to work in a jupyter notebook, but the animation gets really slow. In an offline mode simply nothing changes…;( Frustration x() Any ideas?: please?
import plotly
from plotly.offline import download_plotlyjs, plot
#yes, i actually do have m credentials here
plotly.tools.set_credentials_file(username=’’, api_key=’’)
y=np.linspace(0,6*np.pi,200)
x=np.zeros(len(y))#([i*2, i*2+1])
z=np.sin(y)
traces=[dict(
z=[[cz,cz] for cz in z],
x=[[cx,cx+1] for cx in x],
y=[[cy,cy] for cy in y],
colorscale=[ [i, ‘rgb(100,100,255)’] for i in np.arange(0,1.1,0.1) ],
showscale=False,
type=‘surface’,
)]
malpha=np.linspace(0,90,5)
malpha=[float(xx)/180*3.1415 for xx in malpha]
mfr=[]
for ii in malpha:
mcam= dict(
up=dict(x=-np.sin(ii), y=0, z=np.cos(ii)),
center=dict(x=0, y=0, z=0),
eye=dict(x=2.5np.cos(ii), y=0, z=2.5np.sin(ii)),
)
mfr.append(dict(layout= dict(scene=dict(camera= mcam),title=(‘Cur angle:’+str(ii/3.1415*180))) ))
cam0 = dict(
up=dict(x=0, y=0, z=1),
center=dict(x=0, y=0, z=0),
eye=dict(x=2.5, y=0, z=0)
)
fig = {‘data’:traces,
‘frames’:mfr,
‘layout’:{ ‘scene’:{‘camera’:cam0},
‘updatemenus’: [{‘type’: ‘buttons’,
‘buttons’: [{‘label’: ‘Play!’, ‘method’: ‘animate’, ‘args’:[None]}]}],
‘title’:‘Ribbon Plot’} }
plot(fig,filename=‘ribbon-plot-python2’)