vega

Disconnect points to plot overlay in Vega-lite / Vega

徘徊边缘 提交于 2019-12-11 08:33:31
问题 An example in vega-editor here I don’t want dateTime 5 & dateTime 7 to be connected since they are not consecutive. Idea is to plot on overlay based on some condition and connect only when the count is >=5. Has anyone tried this already? 回答1: You can replace your filter statement: {"filter": "datum.count >= 5"} With a calculate statement that sets filtered values to null: {"as": "count", "calculate": "if(datum.count >= 5, datum.count, null)"} The result is here 来源: https://stackoverflow.com

Install v2png program from vega (node.js module) on Windows

一笑奈何 提交于 2019-12-10 16:10:08
问题 The export_png() function in the R ggvis package requires us to have the program vg2png installed, from the node.js module vega . (source: R Documentation ) I have node and npm installed on windows, and I ran npm install vega . This is the output that I got on running npm install vega : C:\Users\username>npm install -g trifacta/vega \ > canvas@1.1.6 install C:\Users\username\AppData\Roaming\npm\node_modules\vega\node_modules\canvas > node-gyp rebuild | C:\Users\username\AppData\Roaming\npm

Altair/Vega-Lite bar chart: filter top K bars from aggregated field

删除回忆录丶 提交于 2019-12-10 11:34:51
问题 I'm visualizing a dataset that has, for instance, a categorical field. I want to create a bar chart that shows the different categories for that field with their cardinality, sorted in 'ascendind'/'descending' order. This can simply be achieved with altair : import pandas as pd import altair as alt data = {0:{'Name':'Mary', 'Sport':'Tennis'}, 1:{'Name':'Cal', 'Sport':'Tennis'}, 2:{'Name':'John', 'Sport':'Tennis'}, 3:{'Name':'Jane', 'Sport':'Tennis'}, 4:{'Name':'Bob', 'Sport':'Golf'}, 5:{'Name

How to read geojson with vega

丶灬走出姿态 提交于 2019-12-06 14:58:09
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] } ] } ] You have to parse the features using property within your format: "format": {"type": "json", "property":"features"}, Full example spec: {"$schema": "https://vega.github.io/schema/vega/v3.0.json", "width": 500, "height": 600, "autosize": "none", "signals": [ { "name": "translate0",

Can we add event listeners to “Vega-Lite” specification?

我与影子孤独终老i 提交于 2019-12-06 00:56:29
I am new to Vega and Vega-Lite. I am creating a simple bar chart using Vega-Lite but I am not able to add any event listeners e.g. "hover". I want to hover a bar and change the color of the bar. If you're using Vega-Embed , it returns a promise with a reference to the view which allows you to use addEventListener - explained in the docs here . Here is an example: const width = 600 const color = blue embed(element, { $schema: 'https://vega.github.io/schema/vega-lite/3.0.0-rc6.json', data: { 'values': data }, mark: { type: 'line', color, point: { color, } }, width, height: width / 2, encoding: {

Knitting RMarkdown with ggvis to Word

杀马特。学长 韩版系。学妹 提交于 2019-12-04 09:34:56
When I try to knit a RMarkdown document with ggvis plots to Word, I get the following message from Rstudio. Error: Functions that produce HTML output found in document targeting docx output. Please change the output type of this document to HTML. Execution halted Does there exist an elegant solution (without too much effort) to make this possible, perhaps using export_png and vg2png ? Here is an example: ```{r setup, include=FALSE} library(dplyr) library(ggvis) ``` The following table looks fine... As long as I don't include this plot below ```{r, echo=FALSE, include=FALSE} p <- pressure %>%

How to plot several variables on an axis with Vega-Lite?

空扰寡人 提交于 2019-12-04 05:19:46
问题 Following Vega-Lite's Seattle weather tutorial, it was easy to plot avg min temperature by month: { "$schema": "https://vega.github.io/schema/vega-lite/v2.json", "data": { "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv" }, "mark": "line", "encoding": { "x": { "timeUnit": "month", "field": "date", "type": "temporal" }, "y": { "aggregate": "mean", "field": "temp_min", "type": "quantitative" } } } This dataset also has temp_max variable. How can I plot both temp_min and temp

Kibana VEGA - how to build CHART using MULTIPLE buckets aggregations?

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I can't figure out how to deal with 2 buckets to draw a multi-view graph in Vega for Kibana. My index in Kibana contains orderbooks that aggregates orders per label bucket (e.g: USD/CAD). How do I build a VEGA chart in Kibana that works with 2 buckets? This is how I try to use Vega to draw multi-view graphs Vega query { "$schema": "https://vega.github.io/schema/vega-lite/v2.json", "title": "Order Totals vs Order Ids", "data": { "url": { "index": "orderindex", "body": { "size": 0, "_source": { "excludes": [] }, "aggs": { "order_labels": {

How to plot several variables on an axis with Vega-Lite?

核能气质少年 提交于 2019-12-02 04:10:43
Following Vega-Lite's Seattle weather tutorial, it was easy to plot avg min temperature by month: { "$schema": "https://vega.github.io/schema/vega-lite/v2.json", "data": { "url": "https://vega.github.io/vega-lite/data/seattle-weather.csv" }, "mark": "line", "encoding": { "x": { "timeUnit": "month", "field": "date", "type": "temporal" }, "y": { "aggregate": "mean", "field": "temp_min", "type": "quantitative" } } } This dataset also has temp_max variable. How can I plot both temp_min and temp_max on y-axis? You can use layering as described at https://vega.github.io/vega-lite/docs/layer.html . {

学习kibana 和 vega的链接

安稳与你 提交于 2019-12-01 09:46:21
学习kibana 和 vega的链接如下: https://www.elastic.co/cn/webinars/vega-plugin-custom-visualizations-with-kibana https://www.elastic.co/cn/blog/getting-started-with-vega-visualizations-in-kibana https://www.timroes.de/kibana-vega-scatterplot 来源: https://www.cnblogs.com/donefive/p/11676154.html