Last active
March 5, 2021 15:31
-
-
Save alex-rind/d466f991368f3a8cd9012347b29adc04 to your computer and use it in GitHub Desktop.
Vega-Lite ParCoord Vollimunisierte Mar 05 2021
This file contains hidden or 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
| { | |
| "$schema": "https://vega.github.io/schema/vega-lite/v5.json", | |
| "description": "Anteile der Vollimmunisierten an der Bevölkerungszahl der jeweiligen Altersgruppe in Prozent (via ORF). Though Vega-Lite supports only one scale per axes, one can create a parallel coordinate plot by folding variables, using `joinaggregate` to normalize their values and using ticks and rules to manually create axes.", | |
| "data": { | |
| "values": | |
| [ | |
| { | |
| "Gebiet": "Kärnten", | |
| "16-24": 0.44, | |
| "25-34": 1.31, | |
| "35-44": 2.33, | |
| "45-54": 2.73, | |
| "55-64": 2.41, | |
| "65-74": 1.81, | |
| "75-84": 5.39, | |
| ">84": 31.18 | |
| }, | |
| { | |
| "Gebiet": "Oberösterreich", | |
| "16-24": 0.52, | |
| "25-34": 1.33, | |
| "35-44": 2.05, | |
| "45-54": 2.56, | |
| "55-64": 2.37, | |
| "65-74": 1.87, | |
| "75-84": 12.62, | |
| ">84": 26.9 | |
| }, | |
| { | |
| "Gebiet": "Österreich", | |
| "16-24": 1.11, | |
| "25-34": 1.99, | |
| "35-44": 2.81, | |
| "45-54": 3.45, | |
| "55-64": 3.08, | |
| "65-74": 1.97, | |
| "75-84": 5.52, | |
| ">84": 16.34 | |
| }, | |
| { | |
| "Gebiet": "Salzburg", | |
| "16-24": 0.76, | |
| "25-34": 1.6, | |
| "35-44": 2.31, | |
| "45-54": 2.87, | |
| "55-64": 2.69, | |
| "65-74": 1.8, | |
| "75-84": 4.46, | |
| ">84": 15.47 | |
| }, | |
| { | |
| "Gebiet": "Wien", | |
| "16-24": 1.43, | |
| "25-34": 2.47, | |
| "35-44": 2.96, | |
| "45-54": 3.79, | |
| "55-64": 3.68, | |
| "65-74": 1.75, | |
| "75-84": 4.06, | |
| ">84": 14.55 | |
| }, | |
| { | |
| "Gebiet": "Tirol", | |
| "16-24": 0.7, | |
| "25-34": 1.46, | |
| "35-44": 1.96, | |
| "45-54": 2.58, | |
| "55-64": 2.33, | |
| "65-74": 1.84, | |
| "75-84": 4.77, | |
| ">84": 14.27 | |
| }, | |
| { | |
| "Gebiet": "Vorarlberg", | |
| "16-24": 1.57, | |
| "25-34": 2.3, | |
| "35-44": 3.13, | |
| "45-54": 4.31, | |
| "55-64": 4.65, | |
| "65-74": 3.19, | |
| "75-84": 4.81, | |
| ">84": 12.87 | |
| }, | |
| { | |
| "Gebiet": "Steiermark", | |
| "16-24": 0.7, | |
| "25-34": 1.76, | |
| "35-44": 2.94, | |
| "45-54": 3.46, | |
| "55-64": 3.06, | |
| "65-74": 2.5, | |
| "75-84": 4.61, | |
| ">84": 12.86 | |
| }, | |
| { | |
| "Gebiet": "Burgenland", | |
| "16-24": 1.54, | |
| "25-34": 2.28, | |
| "35-44": 2.99, | |
| "45-54": 3.72, | |
| "55-64": 2.68, | |
| "65-74": 1.27, | |
| "75-84": 2.73, | |
| ">84": 9.7 | |
| }, | |
| { | |
| "Gebiet": "Niederösterreich", | |
| "16-24": 1.91, | |
| "25-34": 2.49, | |
| "35-44": 3.56, | |
| "45-54": 4.18, | |
| "55-64": 3.49, | |
| "65-74": 1.88, | |
| "75-84": 3.01, | |
| ">84": 8.97 | |
| } | |
| ] | |
| }, | |
| "width": 600, | |
| "height": 300, | |
| "transform": [ | |
| {"window": [{"op": "count", "as": "index"}]}, | |
| {"fold": ["16-24", "25-34", "35-44", "45-54", "55-64", "65-74", "75-84", ">84"]}, | |
| { | |
| "joinaggregate": [ | |
| {"op": "min", "field": "value", "as": "min"}, | |
| {"op": "max", "field": "value", "as": "max"} | |
| ], | |
| "groupby": ["key"] | |
| }, | |
| { | |
| "calculate": "(datum.value - datum.min) / (datum.max-datum.min)", | |
| "as": "norm_val" | |
| }, | |
| { | |
| "calculate": "(datum.min + datum.max) / 2", | |
| "as": "mid" | |
| } | |
| ], | |
| "layer": [{ | |
| "mark": {"type": "rule", "color": "#ccc"}, | |
| "encoding": { | |
| "detail": {"aggregate": "count"}, | |
| "x": {"field": "key"} | |
| } | |
| }, { | |
| "mark": "line", | |
| "encoding": { | |
| "color": {"type": "nominal", "field": "Gebiet"}, | |
| "detail": {"type": "nominal", "field": "index"}, | |
| "opacity": {"value": 0.8}, | |
| "strokeWidth": { | |
| "condition": { | |
| "test": "datum['Gebiet'] === 'Österreich'", | |
| "value": 5 | |
| }, | |
| "value": 2 | |
| }, | |
| "x": {"type": "nominal", "field": "key"}, | |
| "y": {"type": "quantitative", "field": "norm_val", "axis": null} | |
| } | |
| }, { | |
| "encoding": { | |
| "x": {"type": "nominal", "field": "key"}, | |
| "y": {"value": 0} | |
| }, | |
| "layer": [{ | |
| "mark": {"type": "text", "style": "label"}, | |
| "encoding": { | |
| "text": {"aggregate": "max", "field": "max"} | |
| } | |
| }, { | |
| "mark": {"type": "tick", "style": "tick", "size": 4, "color": "#ccc"} | |
| }] | |
| }, { | |
| "encoding": { | |
| "x": {"type": "nominal", "field": "key"}, | |
| "y": {"value": 150} | |
| }, | |
| "layer": [{ | |
| "mark": {"type": "text", "style": "label"}, | |
| "encoding": { | |
| "text": {"aggregate": "min", "field": "mid"} | |
| } | |
| }, { | |
| "mark": {"type": "tick", "style": "tick", "size": 4, "color": "#ccc"} | |
| }] | |
| }, { | |
| "encoding": { | |
| "x": {"type": "nominal", "field": "key"}, | |
| "y": {"value": 300} | |
| }, | |
| "layer": [{ | |
| "mark": {"type": "text", "style": "label"}, | |
| "encoding": { | |
| "text": {"aggregate": "min", "field": "min"} | |
| } | |
| }, { | |
| "mark": {"type": "tick", "style": "tick", "size": 4, "color": "#ccc"} | |
| }] | |
| }], | |
| "config": { | |
| "axisX": {"domain": false, "labelAngle": 0, "tickColor": "#ccc", "title": null}, | |
| "view": {"stroke": null}, | |
| "style": { | |
| "label": {"baseline": "middle", "align": "right", "dx": -5}, | |
| "tick": {"orient": "horizontal"} | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment