在第一张图片中,当我输入一定数量的数字时,我会有一张地图。正如您在第二张地图上看到的那样,它会将空白映射出来。我尝试了不同的范围,其中一些崩溃并输出一张空白地图。例如,即使我将范围从299设置为301并且450也不起作用,第300个地址也不起作用。某些地址阻止我将其映射出来。我已经通过终端将数据限制设置为max。
答案 0 :(得分:0)
我找到了自己问题的答案。至于弹出窗口,我在弹出窗口中添加了parse_html = True来解决我的问题。另外,为了清晰起见,我还单独设置了弹出窗口和图标功能
import numpy as np
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
from plotly.graph_objs import *
init_notebook_mode()
x = np.random.randn(100,1) + 3
y = np.random.randn(100,1) + 10
x = np.reshape(x, 100)
y = np.reshape(y, 100)
color = np.random.randint(0,1000, [100])
color[[1,3,5]] = color[[1,3,5]] + 10000 # create outliers in color var
bar_max = 2000
factor = 0.9 # Normalized location where continuous colorscale should end
trace = Scatter(
x = x,
y = y,
mode = 'markers',
marker=dict(
color = color,
showscale=True,
cmin=0,
cmax= bar_max/factor,
colorscale = [[0, 'rgb(166,206,227, 0.5)'],
[0.05, 'rgb(31,120,180,0.5)'],
[0.2, 'rgb(178,223,138,0.5)'],
[0.5, 'rgb(51,160,44,0.5)'],
[factor, 'rgb(251,154,153,0.5)'],
[factor, 'rgb(227,26,28,0.5)'],
[1, 'rgb(227,26,28,0.5)']
],
colorbar=dict(
tickvals = [0, 500, 1000, 1500, 2000],
ticks='outside'
)
)
)
fig = Figure(data=[trace])
iplot(fig)