Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to plot worldmap with Vincent in iPython notebook

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?

like image 369
predicador37 Avatar asked Aug 03 '26 04:08

predicador37


1 Answers

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.

like image 129
Jakob Avatar answered Aug 04 '26 17:08

Jakob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!