Commit 8293554d by Danyel Fisher

renamings; figure cleanup

parent 86cee174
...@@ -78,17 +78,7 @@ ...@@ -78,17 +78,7 @@
76,"Delaware","50000 to 74999",19.4,337245,77,"south","10" 76,"Delaware","50000 to 74999",19.4,337245,77,"south","10"
77,"Delaware","100000 to 149999",15.0,337245,78,"south","10" 77,"Delaware","100000 to 149999",15.0,337245,78,"south","10"
78,"Delaware","150000 to 199999",5.5,337245,79,"south","10" 78,"Delaware","150000 to 199999",5.5,337245,79,"south","10"
79,"Delaware","200000+",4.7,337245,80,"south","10" 79,"Delaware","200000+",4.7,337245,80,"south","10","south","11"
80,"District of Columbia","<10000",10.6,268015,81,"south","11"
81,"District of Columbia","10000 to 14999",4.4,268015,82,"south","11"
82,"District of Columbia","15000 to 24999",7.6,268015,83,"south","11"
83,"District of Columbia","25000 to 34999",6.8,268015,84,"south","11"
84,"District of Columbia","35000 to 49999",10.1,268015,85,"south","11"
85,"District of Columbia","75000 to 99999",10.4,268015,86,"south","11"
86,"District of Columbia","50000 to 74999",14.5,268015,87,"south","11"
87,"District of Columbia","100000 to 149999",15.6,268015,88,"south","11"
88,"District of Columbia","150000 to 199999",7.8,268015,89,"south","11"
89,"District of Columbia","200000+",12.1,268015,90,"south","11"
90,"Florida","<10000",8.1,7168502,91,"south","12" 90,"Florida","<10000",8.1,7168502,91,"south","12"
91,"Florida","10000 to 14999",6.0,7168502,92,"south","12" 91,"Florida","10000 to 14999",6.0,7168502,92,"south","12"
92,"Florida","15000 to 24999",12.5,7168502,93,"south","12" 92,"Florida","15000 to 24999",12.5,7168502,93,"south","12"
...@@ -509,13 +499,3 @@ ...@@ -509,13 +499,3 @@
507,"Wyoming","100000 to 149999",15.1,222679,508,"west","56" 507,"Wyoming","100000 to 149999",15.1,222679,508,"west","56"
508,"Wyoming","150000 to 199999",4.4,222679,509,"west","56" 508,"Wyoming","150000 to 199999",4.4,222679,509,"west","56"
509,"Wyoming","200000+",2.9,222679,510,"west","56" 509,"Wyoming","200000+",2.9,222679,510,"west","56"
510,"Puerto Rico","<10000",28.9,1254274,511,"other","72"
511,"Puerto Rico","10000 to 14999",11.8,1254274,512,"other","72"
512,"Puerto Rico","15000 to 24999",18.6,1254274,513,"other","72"
513,"Puerto Rico","25000 to 34999",12.3,1254274,514,"other","72"
514,"Puerto Rico","35000 to 49999",11.6,1254274,515,"other","72"
515,"Puerto Rico","75000 to 99999",3.5,1254274,516,"other","72"
516,"Puerto Rico","50000 to 74999",9.4,1254274,517,"other","72"
517,"Puerto Rico","100000 to 149999",2.4,1254274,518,"other","72"
518,"Puerto Rico","150000 to 199999",0.8,1254274,519,"other","72"
519,"Puerto Rico","200000+",0.6,1254274,520,"other","72"
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -10,10 +10,9 @@ ...@@ -10,10 +10,9 @@
<script src="node_modules/vega-lite/build/vega-lite.js"></script> <script src="node_modules/vega-lite/build/vega-lite.js"></script>
<script src="node_modules/vega-embed/vega-embed.js"></script>--> <script src="node_modules/vega-embed/vega-embed.js"></script>-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/vega/3.0.7/vega.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/vega/3.0.8/vega.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vega-lite/2.0.1/vega-lite.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/vega-lite/2.0.3/vega-lite.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vega-embed/3.0.0-rc7/vega-embed.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/vega-embed/3.0.0-rc7/vega-embed.js"></script>
<body> <body>
<div id="header"> <div id="header">
Vega Specification: Vega Specification:
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
"fill": "population", "fill": "population",
"orient": "none", "orient": "none",
"padding": 20, "padding": 20,
"title": "population per state", "title": "Population per state",
"encode": { "encode": {
"legend": { "legend": {
"update": {"x": {"value": 320},"y": {"value": 0}} "update": {"x": {"value": 320},"y": {"value": 0}}
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
"orient": "none", "orient": "none",
"format": ".2%", "format": ".2%",
"padding": 20, "padding": 20,
"title": "Percent swe per state", "title": "Percent engineers per state",
"encode": { "encode": {
"legend": { "legend": {
"update": {"x": {"value": 320},"y": {"value": 220}} "update": {"x": {"value": 320},"y": {"value": 220}}
...@@ -167,7 +167,8 @@ ...@@ -167,7 +167,8 @@
"type": "text", "type": "text",
"encode": { "encode": {
"enter": { "enter": {
"text": {"field": {"parent": "variable"}}, "text": "",
"_text": {"field": {"parent": "variable"}},
"x": {"signal": "width/2"}, "x": {"signal": "width/2"},
"align": {"value": "center"} "align": {"value": "center"}
} }
......
...@@ -6,15 +6,20 @@ ...@@ -6,15 +6,20 @@
"data": { "data": {
"url": "data/cars.csv" "url": "data/cars.csv"
}, },
"mark": "bar", "facet": {
"encoding": {
"row": { "row": {
"field": "body-style", "field": "body-style",
"type": "nominal", "type": "nominal",
"header": { "header": {
"title": "Body Style" "title": "Body Style",
"labelAngle": 360
} }
}, }
},
"spec":{
"mark": "bar",
"encoding": {
"y": { "y": {
"field": "fuel", "field": "fuel",
"type": "nominal", "type": "nominal",
...@@ -31,4 +36,5 @@ ...@@ -31,4 +36,5 @@
} }
} }
} }
} }
\ No newline at end of file }
{
"$schema": "https://vega.github.io/schema/vega/v3.0.json",
"autosize": "pad",
"background": "#ffffff",
"padding": 5,
"data": [
{
"name": "source_0",
"url": "data/cars.csv",
"format": {
"type": "csv",
"parse": {
"city-mpg": "number"
}
},
"transform": [
{
"type": "aggregate",
"groupby": [
"fuel",
"body-style"
],
"ops": [
"average"
],
"fields": [
"city-mpg"
],
"as": [
"average_city-mpg"
]
}
]
},
{
"name": "row_domain",
"source": "source_0",
"transform": [
{
"type": "aggregate",
"groupby": [
"body-style"
]
}
]
}
],
"signals": [
{
"name": "child_width",
"value": 200
},
{
"name": "y_step",
"value": 21
},
{
"name": "child_height",
"update": "bandspace(domain('y').length, 0.1, 0.05) * y_step"
}
],
"layout": {
"padding": {
"row": 10,
"column": 10
},
"offset": 10,
"columns": 1,
"bounds": "full",
"align": "all"
},
"marks": [
{
"name": "row_title",
"role": "row-title",
"type": "group",
"marks": [
{
"type": "text",
"role": "row-title-text",
"style": "guide-title",
"encode": {
"update": {
"align": {
"value": "center"
},
"text": {
"value": "Body Style"
},
"angle": {
"value": 270
}
}
}
}
]
},
{
"name": "row_header",
"type": "group",
"role": "row-header",
"from": {
"data": "row_domain"
},
"sort": {
"field": "datum[\"body-style\"]",
"order": "ascending"
},
"title": {
"text": {
"signal": "''+parent[\"body-style\"]"
},
"offset": 30,
"orient": "left",
"style": "guide-label",
"encode": {
"update": {
"limit":50,
"angle": {
"value": 360
}
}
}
},
"encode": {
"update": {
"height": {
"signal": "child_height"
}
}
},
"axes": [
{
"title": "Fuel",
"scale": "y",
"orient": "left",
"zindex": 1
}
]
},
{
"name": "column_footer",
"type": "group",
"role": "column-footer",
"encode": {
"update": {
"width": {
"signal": "child_width"
}
}
},
"axes": [
{
"title": "City MPG",
"scale": "x",
"orient": "bottom",
"labelFlush": true,
"labelOverlap": true,
"tickCount": {
"signal": "ceil(child_width/40)"
},
"zindex": 1
}
]
},
{
"name": "cell",
"type": "group",
"style": "cell",
"from": {
"facet": {
"name": "facet",
"data": "source_0",
"groupby": [
"body-style"
]
}
},
"sort": {
"field": [
"datum[\"body-style\"]"
],
"order": [
"ascending"
]
},
"encode": {
"update": {
"width": {
"signal": "child_width"
},
"height": {
"signal": "child_height"
}
}
},
"marks": [
{
"name": "child_marks",
"type": "rect",
"style": [
"bar"
],
"from": {
"data": "facet"
},
"encode": {
"update": {
"x": {
"scale": "x",
"field": "average_city-mpg"
},
"x2": {
"scale": "x",
"value": 0
},
"y": {
"scale": "y",
"field": "fuel"
},
"height": {
"scale": "y",
"band": true
},
"fill": {
"value": "#4c78a8"
}
}
}
}
],
"axes": [
{
"scale": "x",
"orient": "bottom",
"domain": false,
"grid": true,
"labels": false,
"maxExtent": 0,
"minExtent": 0,
"tickCount": {
"signal": "ceil(child_width/40)"
},
"ticks": false,
"zindex": 0,
"gridScale": "y"
}
]
}
],
"scales": [
{
"name": "x",
"type": "linear",
"domain": {
"data": "source_0",
"field": "average_city-mpg"
},
"range": [
0,
{
"signal": "child_width"
}
],
"nice": true,
"zero": true
},
{
"name": "y",
"type": "band",
"domain": {
"data": "source_0",
"field": "fuel",
"sort": true
},
"range": {
"step": {
"signal": "y_step"
}
},
"paddingInner": 0.1,
"paddingOuter": 0.05
}
],
"config": {
"axisY": {
"minExtent": 30
},
"background": "#ffffff"
}
}
\ No newline at end of file
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
"enter": { "enter": {
"strokeWidth": {"value": "1"}, "strokeWidth": {"value": "1"},
"stroke": {"value": "#fff"}, "stroke": {"value": "#fff"},
"fill": {"value": "#ddd"}, "fill": {"value": "#efefef"},
"path": {"field": "path"} "path": {"field": "path"}
} }
} }
......
{
"$schema": "https://vega.github.io/schema/vega/v3.0.json",
"autosize": "pad",
"background": "#ffffff",
"padding": 5,
"data": [
{
"name": "source_0",
"url": "data/cars.csv",
"format": {
"type": "csv",
"parse": {
"city-mpg": "number"
}
},
"transform": [
{
"type": "aggregate",
"groupby": [
"fuel",
"body-style"
],
"ops": [
"average"
],
"fields": [
"city-mpg"
],
"as": [
"average_city-mpg"
]
}
]
},
{
"name": "row_domain",
"source": "source_0",
"transform": [
{
"type": "aggregate",
"groupby": [
"body-style"
]
}
]
}
],
"signals": [
{
"name": "child_width",
"value": 200
},
{
"name": "y_step",
"value": 21
},
{
"name": "child_height",
"update": "bandspace(domain('y').length, 0.1, 0.05) * y_step"
}
],
"layout": {
"padding": {
"row": 10,
"column": 10
},
"offset": 10,
"columns": 1,
"bounds": "full",
"align": "all"
},
"marks": [
{
"name": "row_title",
"role": "row-title",
"type": "group",
"marks": [
{
"type": "text",
"role": "row-title-text",
"style": "guide-title",
"encode": {
"update": {
"align": {
"value": "center"
},
"text": {
"value": "Body Style"
},
"angle": {
"value": 270
}
}
}
}
]
},
{
"name": "row_header",
"type": "group",
"role": "row-header",
"from": {
"data": "row_domain"
},
"sort": {
"field": "datum[\"body-style\"]",
"order": "ascending"
},
"title": {
"text": {
"signal": "''+parent[\"body-style\"]"
},
"offset": 30,
"orient": "left",
"style": "guide-label",
"encode": {
"update": {
"limit":50,
"angle": {
"value": 360
}
}
}
},
"encode": {
"update": {
"height": {
"signal": "child_height"
}
}
},
"axes": [
{
"title": "Fuel",
"scale": "y",
"orient": "left",
"zindex": 1
}
]
},
{
"name": "column_footer",
"type": "group",
"role": "column-footer",
"encode": {
"update": {
"width": {
"signal": "child_width"
}
}
},
"axes": [
{
"title": "City MPG",
"scale": "x",
"orient": "bottom",
"labelFlush": true,
"labelOverlap": true,
"tickCount": {
"signal": "ceil(child_width/40)"
},
"zindex": 1
}
]
},
{
"name": "cell",
"type": "group",
"style": "cell",
"from": {
"facet": {
"name": "facet",
"data": "source_0",
"groupby": [
"body-style"
]
}
},
"sort": {
"field": [
"datum[\"body-style\"]"
],
"order": [
"ascending"
]
},
"encode": {
"update": {
"width": {
"signal": "child_width"
},
"height": {
"signal": "child_height"
}
}
},
"marks": [
{
"name": "child_marks",
"type": "rect",
"style": [
"bar"
],
"from": {
"data": "facet"
},
"encode": {
"update": {
"x": {
"scale": "x",
"field": "average_city-mpg"
},
"x2": {
"scale": "x",
"value": 0
},
"y": {
"scale": "y",
"field": "fuel"
},
"height": {
"scale": "y",
"band": true
},
"fill": {
"value": "#4c78a8"
}
}
}
}
],
"axes": [
{
"scale": "x",
"orient": "bottom",
"domain": false,
"grid": true,