这个问题可能与在IPython中使用vincent的Unable情节有关,尽管我认为这不是完全相同的问题。
我可以在IPython 0.13.1笔记本中使用Vincent 0.4.4绘制条形图,如下例所示(在文档中找到):
import vincent vincent.core.initialize_notebook() bar = vincent.Bar(multi_iter1['y1']) bar.axis_titles(x='Index', y='Value') bar.display()但是,我无法对数据映射示例中的worldmap表示做同样的事情:
import vincent geo_data = [{'name': 'countries', 'url': world_topo, 'feature': 'world-countries'}] vis = vincent.Map(geo_data=geo_data, scale=200) vis.to_json('vega.json')我已将值'world_topo'替换为从此处下载的Topojson文件(world-countries.topo.json)的路径。
没有显示错误,也没有任何反应。 顺便说一下,我没有使用HTTPS。 这是最简单的地图图示例,所以我想它应该可以顺利运行......
有任何想法吗?
This question is probably related to Unable plot with vincent in IPython , although I think it's not exactly the same problem.
I can plot a bar chart using Vincent 0.4.4 in an IPython 0.13.1 notebook as in the following example (found in the docs):
import vincent vincent.core.initialize_notebook() bar = vincent.Bar(multi_iter1['y1']) bar.axis_titles(x='Index', y='Value') bar.display()However, I'm unable to do the same thing with the worldmap representation in the data mapping example:
import vincent geo_data = [{'name': 'countries', 'url': world_topo, 'feature': 'world-countries'}] vis = vincent.Map(geo_data=geo_data, scale=200) vis.to_json('vega.json')I've replaced the value 'world_topo' with the path to the Topojson file (world-countries.topo.json) downloaded from here.
No errors are shown and nothing happens. I'm not using HTTPS, by the way. This is the simplest map chart example, so I guess it should work smoothly...
Any ideas?
最满意答案
在vincent的网页之后,需要一个> = 1.0的IPython版本,因此,升级到更新的版本(例如IPython 2.1)很可能解决您的问题。 在我的ubuntu机器上,vega的地图可以很好地工作。
此外,需要在设置绘图后调用vis.display()方法, 如此示例笔记本中所示 。
Following the webpage of vincent an IPython version of >= 1.0 is required, thus, an upgrade to a more recent version (e.g. IPython 2.1) is very likely to solve your problem. On my ubuntu machine the map plot of vega works nicely.
Moreover, it is required to call the vis.display() method after the setup of the plots, as shown in e.g. this example notebook.
更多推荐
发布评论