Unable to plot worldmap with Vincent in iPython notebook

1.7k views Asked by At

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?

2

There are 2 answers

0
Jakob On BEST ANSWER

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.

0
JoeBlabbah On

One thing I tried was to put the world map file in the directory of the Python script. Additionally remember to include

import json
vincent.core.initialize_notebook()