Skip to content

Instantly share code, notes, and snippets.

@lcyraphael
Last active March 31, 2020 14:22
Show Gist options
  • Save lcyraphael/580035d1259325e0a48928cdfd699fa1 to your computer and use it in GitHub Desktop.
Save lcyraphael/580035d1259325e0a48928cdfd699fa1 to your computer and use it in GitHub Desktop.
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"background": "white",
"padding": 5,
"title": {
"anchor": "middle",
"text": "Many arts and cultural charities provide venues and spaces which are now closed."
},
"data": [
{
"name": "data-78e09659238cb4cb177b40b0afa239d5",
"values": [
{
"term": "theatre",
"activeN": 1556,
"fiveVolP": 0.465,
"facilitiesP": 0.339,
"facilitiesN": 527,
"Term": "theatre",
"Number of ACHS charities": 1556,
"% with 5+ volunteers": 46.5,
"% that provide buildings/facilities/open spaces": 33.900000000000006
},
{
"term": "cinema",
"activeN": 200,
"fiveVolP": 0.51,
"facilitiesP": 0.56,
"facilitiesN": 112,
"Term": "cinema",
"Number of ACHS charities": 200,
"% with 5+ volunteers": 51,
"% that provide buildings/facilities/open spaces": 56.00000000000001
},
{
"term": "gallery",
"activeN": 357,
"fiveVolP": 0.381,
"facilitiesP": 0.552,
"facilitiesN": 197,
"Term": "gallery",
"Number of ACHS charities": 357,
"% with 5+ volunteers": 38.1,
"% that provide buildings/facilities/open spaces": 55.2
},
{
"term": "museum",
"activeN": 1411,
"fiveVolP": 0.427,
"facilitiesP": 0.44,
"facilitiesN": 620,
"Term": "museum",
"Number of ACHS charities": 1411,
"% with 5+ volunteers": 42.699999999999996,
"% that provide buildings/facilities/open spaces": 44
},
{
"term": "music",
"activeN": 6963,
"fiveVolP": 0.33,
"facilitiesP": 0.168,
"facilitiesN": 1169,
"Term": "music",
"Number of ACHS charities": 6963,
"% with 5+ volunteers": 33,
"% that provide buildings/facilities/open spaces": 16.8
},
{
"term": "painting",
"activeN": 422,
"fiveVolP": 0.398,
"facilitiesP": 0.405,
"facilitiesN": 170,
"Term": "painting",
"Number of ACHS charities": 422,
"% with 5+ volunteers": 39.800000000000004,
"% that provide buildings/facilities/open spaces": 40.5
}
]
},
{
"name": "data-892bf7e8186dd9ded0ce2c8f968c61e8",
"values": [
{
"term": "isolation",
"activeN": 148,
"fiveVolP": 0.534,
"facilitiesP": 0.378,
"facilitiesN": 55,
"Term": "isolation",
"Number of ACHS charities": 148,
"% with 5+ volunteers": 53.400000000000006,
"% that provide buildings/facilities/open spaces": 37.8
},
{
"term": "wellbeing",
"activeN": 732,
"fiveVolP": 0.53,
"facilitiesP": 0.515,
"facilitiesN": 376,
"Term": "wellbeing",
"Number of ACHS charities": 732,
"% with 5+ volunteers": 53,
"% that provide buildings/facilities/open spaces": 51.5
},
{
"term": "community",
"activeN": 8367,
"fiveVolP": 0.439,
"facilitiesP": 0.604,
"facilitiesN": 5053,
"Term": "community",
"Number of ACHS charities": 8367,
"% with 5+ volunteers": 43.9,
"% that provide buildings/facilities/open spaces": 60.4
}
]
},
{
"name": "data-48fa555ec361970847a118c3e286ee1f",
"values": [{"img": "https://i.imgur.com/EMmnXB2.png"}]
},
{
"name": "data_1",
"source": "data-78e09659238cb4cb177b40b0afa239d5",
"transform": [
{
"type": "filter",
"expr": "isValid(datum[\"activeN\"]) && isFinite(+datum[\"activeN\"])"
}
]
},
{
"name": "data_2",
"source": "data-78e09659238cb4cb177b40b0afa239d5",
"transform": [
{
"type": "formula",
"expr": "1500 * datum.facilitiesP",
"as": "facSize"
},
{
"type": "filter",
"expr": "isValid(datum[\"fiveVolP\"]) && isFinite(+datum[\"fiveVolP\"]) && isValid(datum[\"facSize\"]) && isFinite(+datum[\"facSize\"]) && isValid(datum[\"activeN\"]) && isFinite(+datum[\"activeN\"])"
}
]
},
{
"name": "data_3",
"source": "data-78e09659238cb4cb177b40b0afa239d5",
"transform": [
{
"type": "filter",
"expr": "((datum.term !== 'theatre') && (datum.term !== 'painting'))"
},
{
"type": "filter",
"expr": "isValid(datum[\"activeN\"]) && isFinite(+datum[\"activeN\"])"
}
]
},
{
"name": "data_4",
"source": "data-78e09659238cb4cb177b40b0afa239d5",
"transform": [
{
"type": "filter",
"expr": "((datum.term === 'theatre') || (datum.term === 'painting'))"
},
{
"type": "filter",
"expr": "isValid(datum[\"activeN\"]) && isFinite(+datum[\"activeN\"])"
}
]
},
{
"name": "data_6",
"source": "data-892bf7e8186dd9ded0ce2c8f968c61e8",
"transform": [
{
"type": "filter",
"expr": "isValid(datum[\"activeN\"]) && isFinite(+datum[\"activeN\"])"
}
]
},
{
"name": "data_7",
"source": "data-892bf7e8186dd9ded0ce2c8f968c61e8",
"transform": [
{
"type": "formula",
"expr": "1500 * datum.facilitiesP",
"as": "facSize"
},
{
"type": "filter",
"expr": "isValid(datum[\"fiveVolP\"]) && isFinite(+datum[\"fiveVolP\"]) && isValid(datum[\"facSize\"]) && isFinite(+datum[\"facSize\"]) && isValid(datum[\"activeN\"]) && isFinite(+datum[\"activeN\"])"
}
]
}
],
"signals": [
{"name": "concat_0_concat_0_width", "value": 600},
{"name": "concat_0_concat_0_height", "value": 100},
{"name": "concat_0_concat_1_width", "value": 600},
{"name": "concat_0_concat_1_height", "value": 100},
{"name": "concat_0_concat_2_width", "value": 20},
{"name": "concat_0_concat_2_height", "value": 20}
],
"layout": {"padding": 20, "bounds": "flush", "align": "each", "center": true},
"marks": [
{
"type": "group",
"name": "concat_0_group",
"layout": {
"padding": 20,
"columns": 1,
"bounds": "full",
"align": "each"
},
"marks": [
{
"type": "group",
"name": "concat_0_concat_0_group",
"style": "cell",
"encode": {
"update": {
"width": {"signal": "concat_0_concat_0_width"},
"height": {"signal": "concat_0_concat_0_height"}
}
},
"signals": [{"name": "height", "update": "concat_0_concat_0_height"}],
"marks": [
{
"name": "concat_0_concat_0_layer_0_marks",
"type": "symbol",
"style": ["point"],
"from": {"data": "data_1"},
"encode": {
"update": {
"opacity": {"value": 0.7},
"size": {"value": 1500},
"fill": {"value": "transparent"},
"stroke": {"value": "#4c78a8"},
"x": {"scale": "concat_0_concat_0_x", "field": "activeN"},
"y": {"signal": "concat_0_concat_0_height", "mult": 0.5}
}
}
},
{
"name": "concat_0_concat_0_layer_1_marks",
"type": "symbol",
"style": ["circle"],
"from": {"data": "data_2"},
"encode": {
"update": {
"opacity": {"value": 0.7},
"fill": {"scale": "concat_0_color", "field": "fiveVolP"},
"tooltip": {
"signal": "{\"Term\": ''+datum[\"Term\"], \"Number of ACHS charities\": format(datum[\"Number of ACHS charities\"], \"\"), \"% with 5+ volunteers\": format(datum[\"% with 5+ volunteers\"], \"\"), \"% that provide buildings/facilities/open spaces\": format(datum[\"% that provide buildings/facilities/open spaces\"], \"\")}"
},
"x": {"scale": "concat_0_concat_0_x", "field": "activeN"},
"y": {"signal": "concat_0_concat_0_height", "mult": 0.5},
"size": {"scale": "size", "field": "facSize"},
"shape": {"value": "circle"}
}
}
},
{
"name": "concat_0_concat_0_layer_2_marks",
"type": "text",
"style": ["text"],
"from": {"data": "data_3"},
"encode": {
"update": {
"dy": {"value": -30},
"fill": {"value": "black"},
"x": {"scale": "concat_0_concat_0_x", "field": "activeN"},
"y": {"signal": "concat_0_concat_0_height", "mult": 0.5},
"text": {"signal": "''+datum[\"term\"]"},
"fontSize": {"value": 14},
"align": {"value": "center"},
"baseline": {"value": "middle"}
}
}
},
{
"name": "concat_0_concat_0_layer_3_marks",
"type": "text",
"style": ["text"],
"from": {"data": "data_4"},
"encode": {
"update": {
"dx": {"value": 10},
"dy": {"value": 30},
"fill": {"value": "black"},
"x": {"scale": "concat_0_concat_0_x", "field": "activeN"},
"y": {"signal": "concat_0_concat_0_height", "mult": 0.5},
"text": {"signal": "''+datum[\"term\"]"},
"fontSize": {"value": 14},
"align": {"value": "center"},
"baseline": {"value": "middle"}
}
}
}
],
"axes": [
{
"scale": "concat_0_concat_0_x",
"orient": "bottom",
"grid": false,
"title": "They also carry out functions that are particularly important during this crisis.",
"labelAlign": "center",
"labelBaseline": "top",
"labelFlush": true,
"labelOverlap": "greedy",
"zindex": 0
}
]
},
{
"type": "group",
"name": "concat_0_concat_1_group",
"style": "cell",
"encode": {
"update": {
"width": {"signal": "concat_0_concat_1_width"},
"height": {"signal": "concat_0_concat_1_height"}
}
},
"signals": [{"name": "height", "update": "concat_0_concat_1_height"}],
"marks": [
{
"name": "concat_0_concat_1_layer_0_marks",
"type": "symbol",
"style": ["point"],
"from": {"data": "data_6"},
"encode": {
"update": {
"opacity": {"value": 0.7},
"size": {"value": 1500},
"fill": {"value": "transparent"},
"stroke": {"value": "#4c78a8"},
"x": {"scale": "concat_0_concat_1_x", "field": "activeN"},
"y": {"signal": "concat_0_concat_1_height", "mult": 0.5}
}
}
},
{
"name": "concat_0_concat_1_layer_1_marks",
"type": "symbol",
"style": ["circle"],
"from": {"data": "data_7"},
"encode": {
"update": {
"opacity": {"value": 0.7},
"fill": {"scale": "concat_0_color", "field": "fiveVolP"},
"tooltip": {
"signal": "{\"Term\": ''+datum[\"Term\"], \"Number of ACHS charities\": format(datum[\"Number of ACHS charities\"], \"\"), \"% with 5+ volunteers\": format(datum[\"% with 5+ volunteers\"], \"\"), \"% that provide buildings/facilities/open spaces\": format(datum[\"% that provide buildings/facilities/open spaces\"], \"\")}"
},
"x": {"scale": "concat_0_concat_1_x", "field": "activeN"},
"y": {"signal": "concat_0_concat_1_height", "mult": 0.5},
"size": {"scale": "size", "field": "facSize"},
"shape": {"value": "circle"}
}
}
},
{
"name": "concat_0_concat_1_layer_2_marks",
"type": "text",
"style": ["text"],
"from": {"data": "data_6"},
"encode": {
"update": {
"dy": {"value": -30},
"fill": {"value": "black"},
"x": {"scale": "concat_0_concat_1_x", "field": "activeN"},
"y": {"signal": "concat_0_concat_1_height", "mult": 0.5},
"text": {"signal": "''+datum[\"term\"]"},
"fontSize": {"value": 14},
"align": {"value": "center"},
"baseline": {"value": "middle"}
}
}
}
],
"axes": [
{
"scale": "concat_0_concat_1_x",
"orient": "bottom",
"grid": false,
"title": "Number of arts and cultural charities mentioning these terms",
"labelAlign": "center",
"labelBaseline": "top",
"labelFlush": true,
"labelOverlap": "greedy",
"zindex": 0
}
]
},
{
"type": "group",
"name": "concat_0_concat_2_group",
"style": "cell",
"encode": {
"update": {
"width": {"signal": "concat_0_concat_2_width"},
"height": {"signal": "concat_0_concat_2_height"}
}
},
"marks": [
{
"name": "concat_0_concat_2_marks",
"type": "image",
"style": ["image"],
"from": {"data": "data-48fa555ec361970847a118c3e286ee1f"},
"encode": {
"update": {
"width": {"value": 460},
"height": {"value": 220},
"x": {"field": {"group": "width"}},
"yc": {"value": 0},
"url": {"signal": "''+datum[\"img\"]"}
}
}
}
]
}
],
"legends": [
{
"direction": "horizontal",
"format": "~%",
"title": "Percentage with 5+ volunteers listed on register",
"fill": "concat_0_color",
"gradientLength": 200,
"symbolType": "circle",
"encode": {"gradient": {"update": {"opacity": {"value": 0.7}}}}
}
]
}
],
"scales": [
{
"name": "size",
"type": "linear",
"domain": {
"fields": [
{"data": "data_2", "field": "facSize"},
{"data": "data_7", "field": "facSize"}
]
},
"range": [0, 361],
"zero": true
},
{
"name": "concat_0_color",
"type": "linear",
"domain": {
"fields": [
{"data": "data_2", "field": "fiveVolP"},
{"data": "data_7", "field": "fiveVolP"}
]
},
"range": {"scheme": "redpurple"},
"interpolate": "hcl",
"zero": false
},
{
"name": "concat_0_concat_0_x",
"type": "log",
"domain": {
"fields": [
{"data": "data_1", "field": "activeN"},
{"data": "data_2", "field": "activeN"},
{"data": "data_3", "field": "activeN"},
{"data": "data_4", "field": "activeN"}
]
},
"range": [0, {"signal": "concat_0_concat_0_width"}],
"base": 5,
"nice": true
},
{
"name": "concat_0_concat_1_x",
"type": "log",
"domain": {
"fields": [
{"data": "data_6", "field": "activeN"},
{"data": "data_7", "field": "activeN"}
]
},
"range": [0, {"signal": "concat_0_concat_1_width"}],
"base": 5,
"nice": true
}
],
"config": {
"axis": {
"domain": true,
"grid": false,
"labelFont": "Century Gothic",
"labelFontSize": 14,
"labelFontWeight": 500,
"labelLimit": 0,
"labelPadding": 10,
"ticks": true,
"titleFont": "Century Gothic",
"titleFontSize": 16,
"titlePadding": 10
},
"axisLeft": {"titleAngle": 270, "titleX": -320},
"axisBottom": {"labelAngle": 360, "orient": "top"},
"legend": {
"labelFont": "Century Gothic",
"labelFontSize": 14,
"labelLimit": 0,
"legendX": 26,
"legendY": 435,
"orient": "none",
"titleFont": "Century Gothic",
"titleFontSize": 16,
"titleLimit": 0
},
"style": {
"cell": {"strokeOpacity": 0},
"text": {"font": "Century Gothic", "fontSize": 14},
"group-title": {"dy": -10, "font": "Century Gothic", "fontSize": 16}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment