清空2d柱状图

时间:2018-06-02 09:57:13

标签: python histogram plotly

我使用此代码:

import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np

z = []
c = []

for i in range(0,100,2):
    z.append(embedding[i])
    c.append(embedding2[i])

x = np.asarray(z)
y = np.asarray(c)

print (x)
print (y)

data = [
    go.Histogram2d(
        x=x,
        y=y
    )
]
py.iplot(data)

嵌入是两个np.ndarray,其形状为(10242,10242)。数据传递到直方图,下面打印出xy。循环只是为了减少此测试的数据。

[[ -1.07009469e-03  -4.14190844e-05      2.83694127e-05 ...,  3.80232710e-49 1.11805697e-48   1.35691326e-49]  
        [ -2.51900739e-04  -1.24530108e-04   1.06271439e-04 ...,  -1.70912532e-49 3.49318016e-49  -6.71164371e-50]  
        [  4.75347102e-04  -2.99087401e-04   7.38855263e-06 ...,  -1.77945437e-50 2.50268997e-49   1.32159499e-49]  
        ...,   
        [  7.19245324e-05   3.62139711e-06   6.79869681e-05 ...,   9.24108834e-37 2.77809808e-36  -1.77212812e-36]  
        [  1.49892464e-04   8.55360952e-05   8.07507441e-05 ...,  -4.85739967e-49 3.32748802e-49  -1.22085056e-49]  
        [  3.94947451e-05  -7.60262599e-05  -1.83208907e-05 ...,   7.93846393e-50 3.08010941e-50   8.93558373e-51]] 
[[ -1.07009469e-03  -4.14190844e-05   2.83694127e-05 ...,   3.80232710e-49 1.11805697e-48   1.35691326e-49]  
        [ -2.51900739e-04  -1.24530108e-04   1.06271439e-04 ...,  -1.70912532e-49 3.49318016e-49  -6.71164371e-50]  
        [  4.75347102e-04  -2.99087401e-04   7.38855263e-06 ...,  -1.77945437e-50 2.50268997e-49   1.32159499e-49]  
        ...,   
        [  7.19245324e-05   3.62139711e-06   6.79869681e-05 ...,   9.24108834e-37 2.77809808e-36  -1.77212812e-36]  
        [  1.49892464e-04   8.55360952e-05   8.07507441e-05 ...,  -4.85739967e-49 3.32748802e-49  -1.22085056e-49]  
        [  3.94947451e-05  -7.60262599e-05  -1.83208907e-05 ...,   7.93846393e-50 3.08010941e-50   8.93558373e-51]]

但是产生的输出是空的: enter image description here

为什么会这样?我该如何显示数据?

0 个答案:

没有答案