I created some maps using Vincent and I can display them in the iPython notebook. I am trying to export them to a vector graphic but I do not seem to find a natural way to do it. I used the function to_json() in order to generate a JSON file that I can copy and paste into the Vega Live Editor. Unfortunately, the JSON code generated do not seem to work with the Vega Live Editor. JSON maps from other sources work fine with the Live Editor, but not the ones generated from Vincent. I was wondering if anyone has encountered this problem as well. I do not know if this is a problem of the to_json() function or of the Vega Live Editor. Does anyone know other ways in which I could generate vector images of my maps from the iPython notebooks? Here is the JSON code that I get from Vincent.
Hi,
I created some maps using Vincent and I can display them in the iPython notebook. I am trying to export them to a vector graphic but I do not seem to find a natural way to do it. I used the function to_json() in order to generate a JSON file that I can copy and paste into the Vega Live Editor. Unfortunately, the JSON code generated do not seem to work with the Vega Live Editor. JSON maps from other sources work fine with the Live Editor, but not the ones generated from Vincent. I was wondering if anyone has encountered this problem as well. I do not know if this is a problem of the to_json() function or of the Vega Live Editor. Does anyone know other ways in which I could generate vector images of my maps from the iPython notebooks? Here is the JSON code that I get from Vincent.
Thanks a lot!
{ "axes": [], "data": [ { "name": "table", "values": [ { "x": "Alabama", "y": 3 }, { "x": "Alaska", "y": 0 }, { "x": "Arizona", "y": 7 }, { "x": "Arkansas", "y": 5 }, { "x": "California", "y": 0 }, { "x": "Colorado", "y": 1 }, { "x": "Connecticut", "y": 0 }, { "x": "Delaware", "y": 0 }, { "x": "District of Columbia", "y": 0 }, { "x": "Florida", "y": 0 }, { "x": "Georgia", "y": 0 }, { "x": "Hawaii", "y": 0 }, { "x": "Idaho", "y": 2 }, { "x": "Illinois", "y": 4 }, { "x": "Indiana", "y": 0 }, { "x": "Iowa", "y": 11 }, { "x": "Kansas", "y": 1 }, { "x": "Kentucky", "y": 4 }, { "x": "Louisiana", "y": 0 }, { "x": "Maine", "y": 0 }, { "x": "Maryland", "y": 0 }, { "x": "Massachusetts", "y": 1 }, { "x": "Michigan", "y": 1 }, { "x": "Minnesota", "y": 11 }, { "x": "Mississippi", "y": 0 }, { "x": "Missouri", "y": 0 }, { "x": "Montana", "y": 0 }, { "x": "Nebraska", "y": 0 }, { "x": "Nevada", "y": 7 }, { "x": "New Hampshire", "y": 5 }, { "x": "New Jersey", "y": 0 }, { "x": "New Mexico", "y": 0 }, { "x": "New York", "y": 0 }, { "x": "North Carolina", "y": 9 }, { "x": "North Dakota", "y": 0 }, { "x": "Ohio", "y": 0 }, { "x": "Oklahoma", "y": 7 }, { "x": "Oregon", "y": 0 }, { "x": "Pennsylvania", "y": 0 }, { "x": "Puerto Rico", "y": 0 }, { "x": "Rhode Island", "y": 10 }, { "x": "South Carolina", "y": 0 }, { "x": "South Dakota", "y": 0 }, { "x": "Tennessee", "y": 0 }, { "x": "Texas", "y": 3 }, { "x": "Utah", "y": 0 }, { "x": "Vermont", "y": 10 }, { "x": "Virginia", "y": 0 }, { "x": "Washington", "y": 0 }, { "x": "West Virginia", "y": 3 }, { "x": "Wisconsin", "y": 0 }, { "x": "Wyoming", "y": 3 } ] }, { "format": { "feature": "us_states.geo", "type": "topojson" }, "name": "states", "transform": [ { "as": "value", "default": "noval", "key": "data.properties.NAME", "type": "zip", "with": "table", "withKey": "data.x" }, { "test": "d.path!='noval' && d.value!='noval'", "type": "filter" }, { "projection": "albersUsa", "scale": 1000, "translate": [ 480, 250 ], "type": "geopath", "value": "data" } ], "url": "us_states.topo.json" } ], "height": 500, "legends": [ { "fill": "color", "offset": 0, "properties": {}, "title": "Number of Trades" } ], "marks": [ { "from": { "data": "states" }, "properties": { "enter": { "path": { "field": "path" }, "stroke": { "value": "#000000" }, "strokeOpacity": { "value": 0.5 } }, "update": { "fill": { "field": "value.data.y", "scale": "color" } } }, "type": "path" } ], "padding": "auto", "scales": [ { "domain": [ 0, 11 ], "name": "color", "range": [ "#fff7f3", "#fde0dd", "#fcc5c0", "#fa9fb5", "#f768a1", "#dd3497", "#ae017e", "#7a0177", "#49006a" ], "type": "quantize" } ], "width": 960 }