加入收藏 | 设为首页 | 会员中心 | 我要投稿 商洛站长网 (https://www.0914zz.com/)- AI应用、CDN、边缘计算、云计算、物联网!
当前位置: 首页 > 编程开发 > Python > 正文

python C plotly.offline.iplot给出一个大的空白字段作为输出 C 为什么?

发布时间:2023-12-21 20:02:25 所属栏目:Python 来源:DaWei
导读: 我试图在Jupyter笔记本中创建一个Sankey图表,我的代码基于
the first example shown here.

我最终得到了这个,我可以运行而不会出现任何错误:

import numpy as npy
import pand

我试图在Jupyter笔记本中创建一个Sankey图表,我的代码基于 the first example shown here.

我最终得到了这个,我可以运行而不会出现任何错误:

import numpy as npy import pandas as pd import plotly as ply ply.offline.init_notebook_mode(connected=True) df = pd.read_csv('C:Usersa245401DesktopTest.csv',sep=';') print(df.head()) print(ply.__version__) data_trace = dict( type='sankey',domain = dict( x = [0,1],y = [0,1] ),orientation = "h",valueformat = ".0f",node = dict( pad = 10,thickness = 30,line = dict( color = "black",width = 0.5 ),label = df['Node,Label'].dropna(axis=0,how='any'),color = df['Color'] ),link = dict( source = df['Source'].dropna(axis=0,target = df['Target'].dropna(axis=0,value = df['Value'].dropna(axis=0,) ) print(data_trace) layout = dict( title = "Test",height = 772,width = 950,font = dict( size = 10 ),) print(layout) fig = dict(data=[data_trace],layout=layout) ply.offline.iplot(fig,filename='Test')

csv文件看起来像这样:

Source;Target;Value;Color;Node,Label 0;2;2958.5;#262C46;Test 1 0;2;236.7;#262C46;Test 2 0;2;1033.4;#262C46;Test 3 0;2;58.8;#262C46;Test 4 0;2;5.2;#262C46;Test 5 0;2;9.4;#262C46;Test 6 0;2;3.4;#262C46;Test 7

它似乎运行良好,各种输出乍一看,但ply.offline.iplot的最终输出(图,文件名=’测试’)只显示一个大的空白字段:

在运行笔记本中的所有单元格后,终端看起来像这样:

有人可以指点我到哪里错了吗?

>编辑:我也在剧情论坛上发布了这个问题:https://community.plot.ly/t/no-output-from-plotly-offline-iplot/8086 C

解决方法 在过去的Jupyter中,我遇到了类似的问题 C 有时候出现错误的时候/为什么情节会出现意外不一致.从增加的数据速率限制开始可能值得一试.

jupyter notebook CNotebookApp.iopub_data_rate_limit = 1.0e10

(编辑:商洛站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章