- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试在 Jupyter notebook 中创建一个 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:\\Users\\a245401\\Desktop\\Test.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, how='any'),
target = df['Target'].dropna(axis=0, how='any'),
value = df['Value'].dropna(axis=0, how='any'),
)
)
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(fig, filename='Test')< 的最终输出
只显示一个大的空白字段: 运行一次笔记本中的所有单元格后,终端看起来像这样:
谁能指出我哪里出错了?
最佳答案
我过去在 Jupyter 中遇到过类似的脱机绘图问题 - 有时绘图无法显示的时间/原因有时出人意料地不一致。从提高数据速率限制开始可能值得一试。
jupyter 笔记本 --NotebookApp.iopub_data_rate_limit=1.0e10
关于python - plotly.offline.iplot 在 Jupyter Notebook/Lab 中给出一个大的空白字段作为其输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48560138/
我有以下数据集: month is_member not_member 0 April 84 7 1 August 292 85 2 July 353 125 3
我可以解决以下错误吗:“DataFrame”对象没有属性“iplot”?我必须使用 pd.read_csv 为从 csv 文件导入的数据集的每个类别创建箱线图: dataset = pd.read_c
我可以解决以下错误吗:“DataFrame”对象没有属性“iplot”?我必须使用 pd.read_csv 为从 csv 文件导入的数据集的每个类别创建箱线图: dataset = pd.read_c
在过去的 2 个小时里,我一直在努力解决这个问题,但一直没有解决这个错误的方法 - 已经观看了 youtube 视频,通过了 stackoverflow,但我不明白这是哪里出了问题。请注意,我正在使用
一直在使用Python的plotly,但不断遇到上述相同的错误消息。我在 Anaconda 上安装了plotly,分别在 Jupyter 和 Spyder 上收到错误消息: #data manipul
当我运行 de 命令时: iplot(df_final[['ds', 'yhat']].set_index('ds').to_iplot()) 它绘制了以下图表: 观察结果之间的这种奇怪的联系是什么?
我在 R 中运行以下代码但失败了: load(url("http://pages.stat.wisc.edu/~karlrohe/netsci/data/madStuff.RData")) iplot
在 Jupyter Notebook 中显示图形时 plot() 和 iplot() 有什么区别? 最佳答案 我刚开始在 Python (3.6.6) 中使用 iplot()。我认为它使用 Cuffl
This is the image which i have generated using iplot in python 当我使用 iplot 函数时,如何显示相应的数据元素名称。我使用以下命令来
我一直在尝试下载在 google colaboratory 上使用 plotly 创建的图。到目前为止,这是我尝试过的: 我试过改变 files.download('foo.svg') 到 files
当我在 Mac 上的 PyCharm 中运行以下代码时: import numpy as np import pandas as pd from subprocess import check_out
我正在尝试在 Jupyter notebook 中创建一个 Sankey 图表,我的代码基于 the first example shown here . 我最终得到了这个,我可以运行它而不会出现任何
全新的(今天)plotly (Python) 并按照我的方式完成示例和概述。 plotly.offline.iplot 的方法签名声明: figure_or_data -- a plotly.grap
我是一名优秀的程序员,十分优秀!