3

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?

Community
  • 1
  • 1
predicador37
  • 229
  • 3
  • 14
  • 1
    2 comments: 1) The [webpage](https://github.com/wrobstory/vincent) of vincent states that it works with IPython 1.0, so can you upgrade to a more recent version? With IPython 2.0 it works fine following the example [notebook](http://nbviewer.ipython.org/github/wrobstory/vincent/blob/master/examples/Vincent_Examples.ipynb), 2) don't forget to call `vis.display()` – Jakob May 31 '14 at 07:01
  • Hi, Jakob! You were totally right. I was calling vis.display() already (I forgot to include in the code, my mistake) but looking with more detail I realized the problem was caused by the 'url' param: my IPython version showed 404 when looking for the json topology file. I was trying using a relative path with the "file:\\\" protocol without success. Updating to the last version of IPhython did the trick and solved the problem. – predicador37 Jun 01 '14 at 17:45
  • Should you post your comment as an answer in order for me to accept it? – predicador37 Jun 01 '14 at 17:55

2 Answers2

3

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.

Jakob
  • 19,815
  • 6
  • 75
  • 94
1

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()
JoeBlabbah
  • 11
  • 2