【发布时间】:2021-08-19 18:58:12
【问题描述】:
import plotly.plotly as py
from plotly.graph_objs import*
trace1=Scatter3d(x=Xe,y=Ye,z=Ze,mode='lines',line=Line(color='rgb(125,125,125)', width=1),hoverinfo='none')
trace2=Scatter3d(x=Xn,
y=Yn,
z=Zn,
mode='markers',
name='actors',
marker=Marker(symbol='dot',
color=eigen,
size=6,colorbar=ColorBar(
title='Colorbar'
),
colorscale='Viridis',
line=Line(color='rgb(158,18,130)', width=0.5)
),
text=labels,
hoverinfo='text'
)
axis=dict(showbackground=False,
showline=False,
zeroline=False,
showgrid=False,
showticklabels=False,
title=''
)
layout = Layout(
title="3D Visualization of the Facebook nodes",
width=1000,
height=1000,
showlegend=False,
scene=Scene(
xaxis=XAxis(axis),
yaxis=YAxis(axis),
zaxis=ZAxis(axis),
),
margin=Margin(
t=100
),
hovermode='closest',
annotations=Annotations([
Annotation(
showarrow=False,
# text="Data source: <a href='http://bost.ocks.org/mike/miserables/miserables.json'>[1] miserables.json</a>",
xref='paper',
yref='paper',
x=0,
y=0.1,
xanchor='left',
yanchor='bottom',
font=Font(
size=14
)
)
]), )
data=Data([trace1, trace2])
fig=Figure(data=data, layout=layout)
py.iplot(fig)
> Blockquote
我有一段旧的 plotly 代码,我收到一条错误消息,指出 plotly 已迁移到图表工作室,我刚刚开始了一个网络分析项目,并且为了可视化我已经拥有的所述/给定数据是在旧版本的 plotly 中完成。请帮助我查看了 plotly 文档,但我不明白它的工作原理。
【问题讨论】:
-
plotly.com/python/v4-migration/… 您可以使用它来帮助您开始如何更改新版本的代码
标签: python graph charts plotly