Hi empet. Sorry to revive this thread but Iโm in serious need of help.
Iโve been trying to adapt your sample code to mine but am having absolutely zero luck. Iโm working with Scattergeo and have no idea where to put the frames you defined about. I tried putting them into go.Figure(frames=frames) but that didnโt work. The button shows up fine and dandy but I for the life of me I canโt get my globe to rotate at all. Can you help??
Current code is below:
# generate visualization
colorsIdx = {'Permanent': 'rgb(224,189,0)', 'Itinerant': 'rgb(40,96,237)'}
shapesIdx = {'Permanent': 'star', 'Itinerant': 'circle'}
cols_colors = merge_v2['Type'].map(colorsIdx)
cols_shapes = merge_v2['Type'].map(shapesIdx)
x_eye, y_eye, z_eye = 1.25, 1.25, 0.8
frames = []
for t in np.arange(0, 6.26, 0.1):
xe, ye, ze = rotate_z(x_eye, y_eye, z_eye, -t)
frames.append(dict(layout=dict(scene=dict(camera=dict(eye=dict(x=xe, y=ye, z=ze))))))
fig = go.Figure(frames=frames)
fig.add_trace(go.Scattergeo(
lon=merge_v2['Longitude'],
lat=merge_v2['Latitude'],
hoverinfo='text',
text=merge_v2['Installation'], # TODO: add staff required
mode='markers',
marker=dict(
size=6,
color=cols_colors,
symbol=cols_shapes,
line=dict(
width=1,
color=cols_colors
)
)))
for i in range(len(merge_v2)):
fig.add_trace(
go.Scattergeo(
lon=[merge_v2['Hub Longitude'][i], merge_v2['Longitude'][i]],
lat=[merge_v2['Hub Latitude'][i], merge_v2['Latitude'][i]],
mode='lines',
text=merge_v2['Installation'][i],
line=dict(width=1, color='red'),
opacity=1
# opacity = float(merge_v2['Staff Required'][i]+1) / float(merge_v2['Staff Required'].max()+1),
)
)
# list of projection types can be found http://etpinard.xyz/plotly-dashboards/map-projections/
fig.update_layout(
title_text='Staffing Model Test Network',
showlegend=False,
autosize=True,
width=1500, height=800,
margin=dict(l=100, r=100, b=40, t=50, pad=1, autoexpand=True),
geo=go.layout.Geo(
projection_type='orthographic',
showland=True,
showcountries=True,
landcolor='rgb(243, 243, 243)',
countrycolor='rgb(204, 204, 204)',
),
updatemenus=[dict(type='buttons',
showactive=False,
y=1,
x=0.8,
xanchor='left',
yanchor='bottom',
pad=dict(t=45, r=10),
buttons=[dict(label='Play',
method='animate',
args=[None, dict(frame=dict(duration=50, redraw=False),
transition=dict(duration=0),
fromcurrent=True,
mode='immediate'
)]
)
]
)
]
)
fig.show(renderer="browser")
print(fig)