User:Qzekrom/sandbox/Open Philanthropy grants

{ "$schema": "https://vega.github.io/schema/vega/v5.json", "description": "Breakdown of Open Philanthropy focus areas by number of grants as of December 4, 2022", "width": 960, "height": 500, "padding": 2.5, "autosize": "none",

"signals": [ {     "name": "layout", "value": "squarify", "bind": { "input": "select", "options": [ "squarify", "binary", "slicedice" ]     }    },    {      "name": "aspectRatio", "value": 1.6, "bind": {"input": "range", "min": 1, "max": 5, "step": 0.1} } ],

"data": [ {     "name": "tree", "values": [ {         "id": 1, "name": "All focus areas" },       {          "id": 2, "name": "Global Health & Wellbeing", "parent": 1 },       {          "id": 3, "name": "Farm Animal Welfare", "parent": 2 },       {          "id": 4, "name": "Cage-Free Reforms", "parent": 3, "size": 65 },       {          "id": 5, "name": "Broiler Chicken Welfare", "parent": 3, "size": 55 },       {          "id": 6, "name": "Fish Welfare", "parent": 3, "size": 31 },       {          "id": 7, "name": "Farm Animal Welfare in Asia", "parent": 3, "size": 93 },       {          "id": 8, "name": "Farm Animal Welfare in Europe", "parent": 3, "size": 47 },       {          "id": 9, "name": "Global Health & Development", "parent": 2 },       {          "id": 10, "name": "GiveWell-Recommended Charities", "parent": 9, "size": 120 },       {          "id": 11, "name": "Science for Global Health", "parent": 9, "size": 11 },       {          "id": 12, "name": "Learning, Experimentation, and Exploration", "parent": 9, "size": 41 },       {          "id": 13, "name": "Other Global Health and Development", "parent": 9, "size": 20 },       {          "id": 14, "name": "Scientific Research", "parent": 2 },       {          "id": 15, "name": "Human Health and Wellbeing", "parent": 14, "size": 60 },       {          "id": 16, "name": "Science Supporting Biosecurity and Pandemic Preparedness", "parent": 14, "size": 7 },       {          "id": 17, "name": "Scientific Innovation: Tools and Techniques", "parent": 14, "size": 6 },       {          "id": 18, "name": "Transformative Basic Science", "parent": 14, "size": 24 },       {          "id": 19, "name": "Other Scientific Research Areas", "parent": 14, "size": 11 },       {          "id": 20, "name": "South Asian Air Quality", "parent": 2, "size": 7 },       {          "id": 21, "name": "Longtermism", "parent": 1 },       {          "id": 22, "name": "Biosecurity & Pandemic Preparedness", "parent": 21, "size": 87 },       {          "id": 23, "name": "Effective Altruism Community Growth", "parent": 21, "size": 590 },       {          "id": 24, "name": "Potential Risks from Advanced Artificial Intelligence", "parent": 21, "size": 125 },       {          "id": 25, "name": "Criminal Justice Reform", "parent": 1, "size": 353 },       {          "id": 26, "name": "History of Philanthropy", "parent": 1, "size": 4 },       {          "id": 27, "name": "Immigration Policy", "parent": 1, "size": 21 },       {          "id": 28, "name": "Macroeconomic Stabilization Policy", "parent": 1, "size": 29 },       {          "id": 29, "name": "Land Use Reform", "parent": 1, "size": 20 }     ],      "transform": [ {         "type": "stratify", "key": "id", "parentKey": "parent" },       {          "type": "treemap", "field": "size", "sort": {"field": "value"}, "round": true, "method": {"signal": "layout"}, "ratio": {"signal": "aspectRatio"}, "size": [{"signal": "width"}, {"signal": "height"}] }     ]    },    {      "name": "nodes", "source": "tree", "transform": [{ "type": "filter", "expr": "datum.children" }] },   {      "name": "leaves", "source": "tree", "transform": [{ "type": "filter", "expr": "!datum.children" }] } ],

"scales": [ {     "name": "color", "type": "ordinal", "domain": {"data": "nodes", "field": "name"}, "range": [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ]   },    {      "name": "size", "type": "ordinal", "domain": [0, 1, 2, 3], "range": [256, 28, 20, 14] },   {      "name": "opacity", "type": "ordinal", "domain": [0, 1, 2, 3], "range": [0.15, 0.5, 0.8, 1.0] } ],

"marks": [ {     "type": "rect", "from": {"data": "nodes"}, "interactive": false, "encode": { "enter": { "fill": {"scale": "color", "field": "name"} },       "update": { "x": {"field": "x0"}, "y": {"field": "y0"}, "x2": {"field": "x1"}, "y2": {"field": "y1"} }     }    },    {      "type": "rect", "from": {"data": "leaves"}, "encode": { "enter": { "stroke": {"value": "#fff"} },       "update": { "x": {"field": "x0"}, "y": {"field": "y0"}, "x2": {"field": "x1"}, "y2": {"field": "y1"}, "fill": {"value": "transparent"} },       "hover": { "fill": {"value": "red"} }     }    },    {      "type": "text", "from": {"data": "nodes"}, "interactive": false, "encode": { "enter": { "font": {"value": "Helvetica Neue, Arial"}, "align": {"value": "center"}, "baseline": {"value": "middle"}, "fill": {"value": "#000"}, "text": {"field": "name"}, "fontSize": {"scale": "size", "field": "depth"}, "fillOpacity": {"scale": "opacity", "field": "depth"} },       "update": { "x": {"signal": "0.5 * (datum.x0 + datum.x1)"}, "y": {"signal": "0.5 * (datum.y0 + datum.y1)"} }     }    }  ] }