-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: supporting channel name string for sorting by another encoding…
- Loading branch information
Showing
113 changed files
with
232 additions
and
8,075 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,237 +0,0 @@ | ||
{ | ||
"$schema": "https://vega.github.io/schema/vega/v5.json", | ||
"description": "The Trellis display by Becker et al. helped establish small multiples as a “powerful mechanism for understanding interactions in studies of how a response depends on explanatory variables”. Here we reproduce a trellis of Barley yields from the 1930s, complete with main-effects ordering to facilitate comparison.", | ||
"autosize": "pad", | ||
"padding": 5, | ||
"data": [ | ||
{"name": "source_0", "url": "data/barley.json", "format": {"type": "json"}}, | ||
{ | ||
"name": "trellis_barley_facet_domain", | ||
"source": "source_0", | ||
"transform": [ | ||
{ | ||
"type": "aggregate", | ||
"groupby": ["site"], | ||
"fields": ["yield"], | ||
"ops": ["median"], | ||
"as": ["median_yield"] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "trellis_barley_facet_domain_row", | ||
"transform": [ | ||
{ | ||
"type": "sequence", | ||
"start": 0, | ||
"stop": { | ||
"signal": "ceil(length(data(\"trellis_barley_facet_domain\")) / 2)" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "trellis_barley_facet_domain_column", | ||
"transform": [ | ||
{ | ||
"type": "sequence", | ||
"start": 0, | ||
"stop": { | ||
"signal": "min(length(data(\"trellis_barley_facet_domain\")), 2)" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "data_2", | ||
"source": "source_0", | ||
"transform": [ | ||
{ | ||
"type": "aggregate", | ||
"groupby": ["variety", "year", "site"], | ||
"ops": ["median"], | ||
"fields": ["yield"], | ||
"as": ["median_yield"] | ||
} | ||
] | ||
} | ||
], | ||
"signals": [ | ||
{"name": "trellis_barley_child_width", "value": 200}, | ||
{"name": "trellis_barley_y_step", "value": 12}, | ||
{ | ||
"name": "trellis_barley_child_height", | ||
"update": "bandspace(domain('trellis_barley_y').length, 1, 0.5) * trellis_barley_y_step" | ||
} | ||
], | ||
"layout": {"padding": 20, "bounds": "full", "align": "all", "columns": 2}, | ||
"marks": [ | ||
{ | ||
"name": "facet-title", | ||
"type": "group", | ||
"role": "column-title", | ||
"title": {"text": "site", "style": "guide-title", "offset": 10} | ||
}, | ||
{ | ||
"name": "trellis_barley_row_header", | ||
"type": "group", | ||
"role": "row-header", | ||
"from": {"data": "trellis_barley_facet_domain_row"}, | ||
"encode": { | ||
"update": {"height": {"signal": "trellis_barley_child_height"}} | ||
}, | ||
"axes": [ | ||
{ | ||
"scale": "trellis_barley_y", | ||
"orient": "left", | ||
"grid": false, | ||
"title": "variety", | ||
"labelOverlap": true, | ||
"zindex": 1 | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "trellis_barley_column_footer", | ||
"type": "group", | ||
"role": "column-footer", | ||
"from": {"data": "trellis_barley_facet_domain_column"}, | ||
"encode": {"update": {"width": {"signal": "trellis_barley_child_width"}}}, | ||
"axes": [ | ||
{ | ||
"scale": "trellis_barley_x", | ||
"orient": "bottom", | ||
"grid": false, | ||
"title": "Median of yield", | ||
"labelFlush": true, | ||
"labelOverlap": true, | ||
"tickCount": {"signal": "ceil(trellis_barley_child_width/40)"}, | ||
"zindex": 1 | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "trellis_barley_cell", | ||
"type": "group", | ||
"title": { | ||
"text": {"signal": "''+parent[\"site\"]"}, | ||
"style": "guide-label", | ||
"frame": "group", | ||
"offset": 10 | ||
}, | ||
"style": "cell", | ||
"from": { | ||
"facet": { | ||
"name": "trellis_barley_facet", | ||
"data": "source_0", | ||
"groupby": ["site"], | ||
"aggregate": { | ||
"fields": ["yield"], | ||
"ops": ["median"], | ||
"as": ["median_yield_by_site"] | ||
} | ||
} | ||
}, | ||
"sort": { | ||
"field": ["datum[\"median_yield_by_site\"]"], | ||
"order": ["ascending"] | ||
}, | ||
"data": [ | ||
{ | ||
"source": "trellis_barley_facet", | ||
"name": "data_0", | ||
"transform": [ | ||
{ | ||
"type": "aggregate", | ||
"groupby": ["variety", "year"], | ||
"ops": ["median"], | ||
"fields": ["yield"], | ||
"as": ["median_yield"] | ||
} | ||
] | ||
} | ||
], | ||
"encode": { | ||
"update": { | ||
"width": {"signal": "trellis_barley_child_width"}, | ||
"height": {"signal": "trellis_barley_child_height"} | ||
} | ||
}, | ||
"marks": [ | ||
{ | ||
"name": "trellis_barley_child_marks", | ||
"type": "symbol", | ||
"style": ["point"], | ||
"from": {"data": "data_0"}, | ||
"encode": { | ||
"update": { | ||
"fill": {"value": "transparent"}, | ||
"stroke": {"scale": "trellis_barley_color", "field": "year"}, | ||
"x": [ | ||
{ | ||
"test": "datum[\"median_yield\"] === null || isNaN(datum[\"median_yield\"])", | ||
"value": 0 | ||
}, | ||
{"scale": "trellis_barley_x", "field": "median_yield"} | ||
], | ||
"y": {"scale": "trellis_barley_y", "field": "variety"} | ||
} | ||
} | ||
} | ||
], | ||
"axes": [ | ||
{ | ||
"scale": "trellis_barley_x", | ||
"orient": "bottom", | ||
"gridScale": "trellis_barley_y", | ||
"grid": true, | ||
"tickCount": {"signal": "ceil(trellis_barley_child_width/40)"}, | ||
"domain": false, | ||
"labels": false, | ||
"maxExtent": 0, | ||
"minExtent": 0, | ||
"ticks": false, | ||
"zindex": 0 | ||
} | ||
] | ||
} | ||
], | ||
"scales": [ | ||
{ | ||
"name": "trellis_barley_x", | ||
"type": "linear", | ||
"domain": {"data": "data_2", "field": "median_yield"}, | ||
"range": [0, {"signal": "trellis_barley_child_width"}], | ||
"zero": false, | ||
"nice": true | ||
}, | ||
{ | ||
"name": "trellis_barley_y", | ||
"type": "point", | ||
"domain": { | ||
"data": "source_0", | ||
"field": "variety", | ||
"sort": {"op": "median", "field": "yield", "order": "descending"} | ||
}, | ||
"range": {"step": {"signal": "trellis_barley_y_step"}}, | ||
"padding": 0.5 | ||
}, | ||
{ | ||
"name": "trellis_barley_color", | ||
"type": "ordinal", | ||
"domain": {"data": "data_2", "field": "year", "sort": true}, | ||
"range": "category" | ||
} | ||
], | ||
"legends": [ | ||
{ | ||
"stroke": "trellis_barley_color", | ||
"gradientLength": { | ||
"signal": "clamp(trellis_barley_child_height, 64, 200)" | ||
}, | ||
"symbolType": "circle", | ||
"title": "year", | ||
"encode": {"symbols": {"update": {"fill": {"value": "transparent"}}}} | ||
} | ||
] | ||
} | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.