无法显示文森特样本地图;没有建议的解决方案工作 [英] Unable to display Vincent sample maps; no suggested solutions work

查看:221
本文介绍了无法显示文森特样本地图;没有建议的解决方案工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



BTW,似乎Vincent是 not更新并且不会是 。所以,寻找替代品(例如, Bokeh )如果你不想使用过时的软件。


This is the same question as each of these questions, but none of the suggested solutions are working for me.

I'm trying to make a US State map in Python with the Vincent package, as shown in this tutorial. I'm using the Canopy editor. When I run this code, nothing shows up in my console. There are no errors that appear.

  • I've placed us_states.topo.json in my Python working directory.
  • I updated Canopy and Vincent.
  • I'm using vincent.core.initialize_notebook() as well as vis.display() like some other users have suggested.

I have no idea what I'm doing wrong....

import vincent

vincent.core.initialize_notebook()

state_topo = 'us_states.topo.json'

geo_data = [{'name': 'states',
             'url': state_topo,
             'feature': 'us_states.geo'},
             ]

vis = vincent.Map(geo_data=geo_data, scale=1000, projection='albersUsa')
vis.to_json('vega.json')
vis.display()

解决方案

If I'm correct Canopy editor can't render Vincent output.

You should use Vincent on the IPython/Jupyter notebook or just output the json to display it on a browser. The code on your example with some minor modifications is:

import vincent

vincent.core.initialize_notebook()
state_topo = "https://raw.githubusercontent.com/wrobstory/vincent_map_data/master/us_states.topo.json"
geo_data = [{'name': 'states',
             'url': state_topo,
             'feature': 'us_states.geo'}]

vis = vincent.Map(geo_data = geo_data, scale = 500, projection = 'albersUsa')
vis.to_json('vega.json')
vis.display()

And the output in an IPython/Jupyter notebook can be seen in the image below:

BTW, it seems Vincent is not updated and it wouldn't be. So, have a look for alternatives (e.g., Bokeh) if you don't want to use obsolete software.

这篇关于无法显示文森特样本地图;没有建议的解决方案工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆