python – plotly.offline.iplot给出一个大的空白字段作为输出 – 为什么?
发布时间:2021-01-24 04:43:52 所属栏目:Python 来源:互联网
导读:我试图在Jupyter笔记本中创建一个Sankey图表,我的代码基于 the first example shown here. 我最终得到了这个,我可以运行而不会出现任何错误: import numpy as npyimport pandas as pdimport plotly as plyply.offline.init_notebook_mode(connected=True)
我试图在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 – 解决方法在过去的Jupyter中,我遇到了类似的问题 – 有时候出现错误的时候/为什么情节会出现意外不一致.从增加的数据速率限制开始可能值得一试.jupyter notebook –NotebookApp.iopub_data_rate_limit = 1.0e10 (编辑:莱芜站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 【Python】python 中 的 memoize 和 memoized
- python – 如何在seaborn的facetgrid中设置可读的xticks?
- 当我运行python manage.py syncdb时,Django避免在数据库中创
- django芹菜 – 如何发送request.FILES [‘photo’]到任务
- python – 对Django Q对象执行逻辑异或
- 在Django-South中,Pesky“Table’my_table’已经存在”
- python – 替换numpy数组中的元素,避免循环
- python – Bokeh中设置的静态路径变量在哪里(对于create_ht
- python .format()重复的字段?
- python – 问题子类化内置类型