Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/compiled/area_density_nested_offset.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
136 changes: 136 additions & 0 deletions examples/compiled/area_density_nested_offset.vg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"background": "white",
"padding": 5,
"width": 400,
"height": 80,
"title": {"text": "Distribution of Body Mass of Penguins", "frame": "group"},
"style": "cell",
"data": [
{
"name": "source_0",
"url": "data/penguins.json",
"format": {"type": "json"},
"transform": [
{
"type": "kde",
"field": "Body Mass (g)",
"groupby": ["Species"],
"extent": [2500, 6500],
"as": ["value", "density"],
"resolve": "shared"
},
{
"type": "impute",
"field": "value",
"groupby": [],
"key": "Species",
"method": "value",
"value": 0
},
{
"type": "impute",
"field": "value",
"groupby": [],
"key": "density",
"method": "value",
"value": 0
},
{
"type": "stack",
"groupby": ["Species", "density"],
"field": "value",
"sort": {"field": [], "order": []},
"as": ["value_start", "value_end"],
"offset": "zero"
}
]
}
],
"marks": [
{
"name": "marks",
"type": "area",
"style": ["area"],
"sort": {"field": "datum[\"value\"]"},
"from": {"data": "source_0"},
"encode": {
"update": {
"orient": {"value": "vertical"},
"fill": {"value": "#4c78a8"},
"description": {
"signal": "\"Body Mass (g): \" + (format(datum[\"value\"], \"\")) + \"; Species: \" + (isValid(datum[\"Species\"]) ? datum[\"Species\"] : \"\"+datum[\"Species\"]) + \"; density: \" + (format(datum[\"density\"], \"\"))"
},
"x": {"scale": "x", "field": "value_end"},
"y": {
"scale": "y",
"field": "Species",
"offset": {"scale": "yOffset", "field": "density"}
},
"y2": {"scale": "y", "value": 0},
"defined": {
"signal": "isValid(datum[\"value\"]) && isFinite(+datum[\"value\"])"
}
}
}
}
],
"scales": [
{
"name": "x",
"type": "linear",
"domain": {"data": "source_0", "fields": ["value_start", "value_end"]},
"range": [0, {"signal": "width"}],
"nice": true,
"zero": false
},
{
"name": "y",
"type": "band",
"domain": {"data": "source_0", "field": "Species", "sort": true},
"range": [0, {"signal": "height"}],
"paddingInner": 0.2,
"paddingOuter": 0.2
},
{
"name": "yOffset",
"type": "linear",
"domain": {"data": "source_0", "field": "density"},
"range": [0, {"signal": "bandwidth('y')"}],
"zero": false
}
],
"axes": [
{
"scale": "x",
"orient": "bottom",
"gridScale": "y",
"grid": true,
"tickCount": {"signal": "ceil(width/40)"},
"domain": false,
"labels": false,
"aria": false,
"maxExtent": 0,
"minExtent": 0,
"ticks": false,
"zindex": 0
},
{
"scale": "x",
"orient": "bottom",
"grid": false,
"title": "Body Mass (g)",
"labelFlush": true,
"labelOverlap": true,
"tickCount": {"signal": "ceil(width/40)"},
"zindex": 0
},
{
"scale": "y",
"orient": "left",
"grid": false,
"title": "Species",
"zindex": 0
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/compiled/area_density_nested_offset_colored.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
162 changes: 162 additions & 0 deletions examples/compiled/area_density_nested_offset_colored.vg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"background": "white",
"padding": 5,
"width": 400,
"height": 80,
"title": {"text": "Distribution of Body Mass of Penguins", "frame": "group"},
"style": "cell",
"data": [
{
"name": "source_0",
"url": "data/penguins.json",
"format": {"type": "json"},
"transform": [
{
"type": "kde",
"field": "Body Mass (g)",
"groupby": ["Species"],
"extent": [2500, 6500],
"as": ["value", "density"],
"resolve": "shared"
},
{
"type": "impute",
"field": "value",
"groupby": [],
"key": "Species",
"method": "value",
"value": 0
},
{
"type": "impute",
"field": "value",
"groupby": [],
"key": "density",
"method": "value",
"value": 0
},
{
"type": "stack",
"groupby": ["Species", "density"],
"field": "value",
"sort": {"field": [], "order": []},
"as": ["value_start", "value_end"],
"offset": "zero"
}
]
}
],
"marks": [
{
"name": "pathgroup",
"type": "group",
"from": {
"facet": {
"name": "faceted_path_main",
"data": "source_0",
"groupby": ["Species"]
}
},
"encode": {
"update": {
"width": {"field": {"group": "width"}},
"height": {"field": {"group": "height"}}
}
},
"marks": [
{
"name": "marks",
"type": "area",
"style": ["area"],
"sort": {"field": "datum[\"value\"]"},
"from": {"data": "faceted_path_main"},
"encode": {
"update": {
"orient": {"value": "vertical"},
"fill": {"scale": "color", "field": "Species"},
"description": {
"signal": "\"Body Mass (g): \" + (format(datum[\"value\"], \"\")) + \"; Species: \" + (isValid(datum[\"Species\"]) ? datum[\"Species\"] : \"\"+datum[\"Species\"]) + \"; density: \" + (format(datum[\"density\"], \"\"))"
},
"x": {"scale": "x", "field": "value_end"},
"y": {
"scale": "y",
"field": "Species",
"offset": {"scale": "yOffset", "field": "density"}
},
"y2": {"scale": "y", "value": 0},
"defined": {
"signal": "isValid(datum[\"value\"]) && isFinite(+datum[\"value\"])"
}
}
}
}
]
}
],
"scales": [
{
"name": "x",
"type": "linear",
"domain": {"data": "source_0", "fields": ["value_start", "value_end"]},
"range": [0, {"signal": "width"}],
"nice": true,
"zero": false
},
{
"name": "y",
"type": "band",
"domain": {"data": "source_0", "field": "Species", "sort": true},
"range": [0, {"signal": "height"}],
"paddingInner": 0.2,
"paddingOuter": 0.2
},
{
"name": "yOffset",
"type": "linear",
"domain": {"data": "source_0", "field": "density"},
"range": [0, {"signal": "bandwidth('y')"}],
"zero": false
},
{
"name": "color",
"type": "ordinal",
"domain": {"data": "source_0", "field": "Species", "sort": true},
"range": "category"
}
],
"axes": [
{
"scale": "x",
"orient": "bottom",
"gridScale": "y",
"grid": true,
"tickCount": {"signal": "ceil(width/40)"},
"domain": false,
"labels": false,
"aria": false,
"maxExtent": 0,
"minExtent": 0,
"ticks": false,
"zindex": 0
},
{
"scale": "x",
"orient": "bottom",
"grid": false,
"title": "Body Mass (g)",
"labelFlush": true,
"labelOverlap": true,
"tickCount": {"signal": "ceil(width/40)"},
"zindex": 0
},
{
"scale": "y",
"orient": "left",
"grid": false,
"title": "Species",
"zindex": 0
}
],
"legends": [{"fill": "color", "symbolType": "circle", "title": "Species"}]
}
22 changes: 22 additions & 0 deletions examples/specs/area_density_nested_offset.vl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": "Distribution of Body Mass of Penguins",
"width": 400,
"height": 80,
"data": {
"url": "data/penguins.json"
},
"mark": {"type": "area", "orient": "vertical"},
"transform": [
{
"density": "Body Mass (g)",
"groupby": ["Species"],
"extent": [2500, 6500]
}
],
"encoding": {
"x": {"field": "value", "type": "quantitative", "title": "Body Mass (g)"},
"yOffset": {"field": "density", "type": "quantitative"},
"y": {"field": "Species", "type": "nominal"}
}
}
23 changes: 23 additions & 0 deletions examples/specs/area_density_nested_offset_colored.vl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": "Distribution of Body Mass of Penguins",
"width": 400,
"height": 80,
"data": {
"url": "data/penguins.json"
},
"mark": {"type": "area", "orient": "vertical"},
"transform": [
{
"density": "Body Mass (g)",
"groupby": ["Species"],
"extent": [2500, 6500]
}
],
"encoding": {
"x": {"field": "value", "type": "quantitative", "title": "Body Mass (g)"},
"yOffset": {"field": "density", "type": "quantitative"},
"y": {"field": "Species", "type": "nominal"},
"color": {"field": "Species", "type": "nominal"}
}
}
22 changes: 22 additions & 0 deletions examples/specs/area_density_nested_offset_middle..json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": "Distribution of Body Mass of Penguins",
"width": 400,
"height": 80,
"data": {
"url": "data/penguins.json"
},
"mark": {"type": "area", "orient": "vertical", "baseline": "middle"},
"transform": [
{
"density": "Body Mass (g)",
"groupby": ["Species"],
"extent": [2500, 6500]
}
],
"encoding": {
"x": {"field": "value", "type": "quantitative", "title": "Body Mass (g)"},
"yOffset": {"field": "density", "type": "quantitative"},
"y": {"field": "Species", "type": "nominal"}
}
}
23 changes: 23 additions & 0 deletions examples/specs/area_density_nested_offset_middle_colored.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": "Distribution of Body Mass of Penguins",
"width": 400,
"height": 80,
"data": {
"url": "data/penguins.json"
},
"mark": {"type": "area", "orient": "vertical", "baseline": "middle"},
"transform": [
{
"density": "Body Mass (g)",
"groupby": ["Species"],
"extent": [2500, 6500]
}
],
"encoding": {
"x": {"field": "value", "type": "quantitative", "title": "Body Mass (g)"},
"yOffset": {"field": "density", "type": "quantitative"},
"y": {"field": "Species", "type": "nominal"},
"color": {"field": "Species", "type": "nominal"}
}
}