The ratio of house prices-to-earnings is derived from the Annual Survey of Hours and Earnings (ASHE) and based on a 1% sample of employee jobs. Presented below is the ratio of median house prices to median earnings based on the incomes of residents living in those areas.
"data": {"url": "data/houseprice_earnings.csv"},
"transform": [{"filter": {"field" : "area_name", "oneOf":["England", "London"]}}],
"width": 600, "height": 300,
"mark": "line",
"encoding": {
"x": {"field": "year", "type": "temporal", "axis": {"format": "%Y", "title": "Year", "grid": false}},
"y": {"field": "prices_earnings_ratio", "type": "quantitative", "axis": {"title": "Prices-to-Earnings Ratio", "grid": false}},
"color": {"field": "area_name", "type": "nominal", "scale": {"range": ["#636363", "#3182bd"]}, "legend": {"title": "Area"}}
},
"config": {"style": {"cell": {"stroke": "transparent"}}}
"data": {"url": "data/london.topojson", "format": {"type": "topojson", "feature": "foo"}},
"transform": [{"lookup": "id", "from":
{"data": {"url": "data/houseprice_earnings.csv"},
"transform": [
{"filter": {"and": [{"field" : "area_type", "equal" : "la"}, {"field" : "year", "equal" : "2016"}]} }],
"key": "id",
"fields": ["area_name", "year", "prices_earnings_ratio", "gridX", "gridY", "annotationX", "annotationY", "lon", "lat"]
}
}],
"projection": {
"type": "mercator"
},
"vconcat": [
{
"width" : 600, "height" : 500,
"layer" :[{
"mark": {"type": "geoshape", "stroke": "#636363", "strokeWidth": 0.1},
"encoding": {
"color": {"field": "prices_earnings_ratio", "type": "quantitative", "scale": {"scheme": "purpleblue", "domain": [3, 15]}, "legend": {
"orient": "right", "title" : null}}
}
},{
"mark": {"type": "text", "fontSize" : 10},
"encoding": {
"text": {"field": "annotationX","type": "nominal"},
"x": {"field": "lon", "type": "longitude"},
"y": {"field": "lat", "type": "latitude"},
"color" : {"value": "#fff7fb"}
}
}]
}, {
"width" : 600, "height" : 500,
"layer" :[{
"mark": "rect",
"encoding": {
"x": {"field": "gridX", "type": "ordinal", "axis" : null},
"y": {"field": "gridY", "type": "ordinal", "axis" : null},
"color": {
"field": "prices_earnings_ratio", "type": "quantitative", "scale": {"scheme": "purpleblue", "domain": [3, 15]}, "opacity": 0, "legend": false}
}
}, {
"mark": {"type": "text", "fontSize" : 10},
"encoding": {
"text": {"field": "annotationX","type": "nominal"},
"x": {"field": "gridX", "type": "ordinal", "axis" : null},
"y": {"field": "gridY", "type": "ordinal", "axis" : null},
"color" : {"value": "#fff7fb"}
}
}]
}],
"config": {"style": {"cell": {"stroke": "transparent"}}}
"data": {"url": "data/houseprice_earnings.csv"},
"transform": [{"filter": {"field" : "area_type", "equal" : "la"}}],
"facet": {
"column": {"field": "gridX", "type": "ordinal"},
"row": {"field": "gridY", "type": "ordinal"}
},
"spec": {
"width": 80, "height": 80,
"layer" : [{
"mark": {"type": "line", "color" : "#636363"},
"encoding": {
"x": {"field": "year", "type": "temporal", "axis": {"format": "%Y", "grid": false}},
"y": {"field": "prices_earnings_ratio", "type": "quantitative"}
}
}, {
{
"mark": {"type": "text", "align": "right", "baseline": "bottom", "font" : "Helvetica Neue", "fontSize" : 9, "dx": 40, "dy": 40},
"encoding": {
"text": {"field": "annotationX","type": "nominal"},
"color" : {"value": "#636363"}
}
}]
},
"config": {
"style": {"cell": {"stroke": "transparent"}, "guide-title": null},
"axis": {"title": null, "ticks": false, "labels": false, "domain": false}
}