在地图上拟合更多的大叶/小叶元素

时间:2018-12-06 16:19:30

标签: python plot leaflet data-visualization folium

Folium是一个基于Leaflet.js的使用Python制作交互式地图的好工具。

在这里我用它在地图上绘制图形。

the_map = folium.Map(tiles="cartodbpositron")
for (u, v) in G.edges():
    if (not bbox) or (in_bbox(u) and in_bbox(v)):
        folium.PolyLine(
            locations=[positions[u][::-1], positions[v][::-1]],
            weight=edge_size_attr[frozenset((u,v))],
            color=get_edge_color(u, v),
            tooltip=get_edge_tooltip(u, v)
        ).add_to(the_map)
return the_map

工作正常。唯一的问题是,可以通过这种方式绘制的边线数量受到严格限制。在几百以上时,Leaflet似乎会丢掉毛巾,并且将不再渲染地图。

我可以做些什么来突破极限并绘制更多的节点和边吗?

enter image description here

1 个答案:

答案 0 :(得分:1)

一个可能的解决方案:

const correctAnswers = [
  "Red Hot Chili Peppers",
  "Rage Against The Machine",
  "Nirvana"
];

let userAnswers = [
  "Red Hot Chili Peppers",
  "Green Day",
  "Nirvana"
];

let numberCorrect = 0;

// Loop over the right answers
correctAnswers.forEach(function(answer, index){
  // Increment the score if the user's answer matches the correct answer.
  numberCorrect = userAnswers[index] === answer ? numberCorrect + 1 : numberCorrect;
});

console.log("You got " + numberCorrect + " out of " + correctAnswers.length + " correct.");

启动jupyter笔记本时,可以允许更高的iopub速度,(@ https://github.com/jupyter/notebook/issues/2287使用的LARGE_NUMBER == 10000000000)。

请谨慎操作,jupyter在此处设置了一个下限,以避免崩溃您的客户端。