vega

How to read geojson with vega

会有一股神秘感。 提交于 2019-12-23 03:12:18
问题 It sounds super simple, but I can't get how can I use geojson, not topojson, for my polygons. that's my current attempt: "data": [ { "name": "nabs", "url": "both_boundaries.geojson", "format": {"type": "json"}, "transform": [ { "type": "geopath", "projection": "mercator", "scale": 74, "center": [-73.99,40.72] } ] } ] 回答1: You have to parse the features using property within your format: "format": {"type": "json", "property":"features"}, Full example spec: {"$schema": "https://vega.github.io

Creating a multiline graph using Vincent

折月煮酒 提交于 2019-12-21 21:39:59
问题 I am attempting to create a multiline graph using Vincent. I have a csv file with the following layout: ,wk1,wk2,wk3,wk4,wk5,wk6,wk7,wk8,wk9 Tom J,97,65,82,65,101,84,79,71,83 Lisa R,95,87,95,65,61,78,93,95,56 Rich F,51,111,50,119,84,77,73,84,60 Anne E,63,68,89,70,95,80,56,75,82 Dan M,83,95,36,115,79,79,65,55,69 Mack W,67,89,72,79,47,64,113,94,33 Here is my code: import pandas as pd import vincent df = pd.read_csv('weekscores.csv', index_col=0) lines = vincent.Line(df) lines.axis_titles(x=

Getting ggvis::export_png() working

被刻印的时光 ゝ 提交于 2019-12-19 07:53:51
问题 Goal Export a ggvis figure as a PNG file (for inclusion in an .Rmd document). Problem I know essentially nothing about Node.js, other than that it is great and I should know more. I get as far as: library(ggvis) mtcars %>% ggvis(~mpg, ~wt) %>% export_png() Writing to file plot.png Guessing layer_points() module.js:340 throw err; ^ Error: Cannot find module 'd3' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364

Getting ggvis::export_png() working

对着背影说爱祢 提交于 2019-12-19 07:53:06
问题 Goal Export a ggvis figure as a PNG file (for inclusion in an .Rmd document). Problem I know essentially nothing about Node.js, other than that it is great and I should know more. I get as far as: library(ggvis) mtcars %>% ggvis(~mpg, ~wt) %>% export_png() Writing to file plot.png Guessing layer_points() module.js:340 throw err; ^ Error: Cannot find module 'd3' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364

How to derive a field from two fields in an Elasticsearch index?

﹥>﹥吖頭↗ 提交于 2019-12-12 01:24:35
问题 I have an index with fields: room_name start_date (start time room is used) end_date (end time room is used) I am creating a curl command wherein I can get the time when a room was used. Is it possible? Here is current curl command: curl -XGET "https://localhost:9200/testindex/_search?pretty" -H 'Content-Type: application/json' -d' { "aggs": { "room_bucket":{ "terms": { "field": "room_name.keyword", }, "aggs":{ "hour_bucket": { "terms": { "script": { "inline": "def l = doc[\"start_date \"]

vega horizontal bar charts

↘锁芯ラ 提交于 2019-12-11 16:22:07
问题 The vega documentation/tutorials suggest that setting up a horizontal bar chart is easy, but I can't figure it out for the life of me. How would I go about changing a vertical bar chart, such as http://vega.github.io/vega-editor/index.html?spec=bar, to a horizontal one? 回答1: Like this { "width": 200, "height": 210, "padding": "auto", "data": [ { "name": "raw", "values": [ {"x": "A","y": 28}, {"x": "B","y": 55}, {"x": "C","y": 43}, {"x": "D","y": 91}, {"x": "E","y": 81}, {"x": "F","y": 53}, {

Emailing vega chart

試著忘記壹切 提交于 2019-12-11 15:18:59
问题 Is there any way I can send vega chart in email from server side? Say from a spring boot app? I have the vega spec saved in db and I can fill up data as well from the server side, was wondering how I can use this to send out an email with the chart. Vega embed won’t work as most of the email clients filter out script tags from body. I tried vega-cli too but since it’s based on nodejs libs I could not integrate it with my spring boot. Appreciate any help find a solution here. 回答1: As discussed

Vega plot with secondary y-axis

a 夏天 提交于 2019-12-11 12:44:47
问题 I'm attempting to create an area plot with a secondary y-axis in Vega. I'm building off of the area chart example shown here in the editor. I've added a "col" field to the data and am using the facet transform to organize the data into groups with "col" as the key. I've added the secondary axis and a scale for each group but I can't figure out how, when declaring the marks, to map the column of data to the appropriate scale. In other words, I don't know how to have "y" and "y2" in the "enter"

Broken axis in Altair/Vega

ⅰ亾dé卋堺 提交于 2019-12-11 08:47:23
问题 I have a Normalized Stacked Area Chart with huge differences between one variable and the others like: df1=pd.DataFrame.from_dict( {'YEAR': {0: 2010, 1: 2010, 2: 2010, 3: 2010, 4: 2011, 5: 2011, 6: 2011, 7: 2011, 8: 2012, 9: 2012, 10: 2012, 11: 2012, 12: 2013, 13: 2013, 14: 2013, 15: 2013}, 'impact_FU': {0: 0.031479085164086554, 1: 5.9856927170853295e-05, 2: 1.1035885271638534e-05, 3: 5.8233509026863169e-06, 4: 0.059176271387395112, 5: 0.00011179170132430088, 6: 1.9783914536689014e-05, 7: 1

Is it possible to add a background image to a plot in vega or vega-lite?

与世无争的帅哥 提交于 2019-12-11 08:40:20
问题 I see from https://vega.github.io/vega-lite/docs/config.html that it is possible to change the background color. But i don't see any docs for adding an underlay background image. 回答1: vega-lite creates a canvas element. So adding a background image is explained in a question about how to add a background to a canvas element. HTML5 Canvas background image But you can just do it with css: canvas { background: url("my_background.png"); } This is just like any other background image css. https:/