{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 200, "height": 200, "style": "cell", "data": [ { "name": "source_0", "values": [ { "ci1": 23.5007, "ci0": 19.6912, "center": 21.5735, "Year": 189302400000 }, { "ci1": 25.8214, "ci0": 20.8554, "center": 23.375, "Year": 220924800000 }, { "ci1": 26.4472, "ci0": 21.9749, "center": 24.0611, "Year": 252460800000 }, { "ci1": 27.7074, "ci0": 22.6203, "center": 25.0931, "Year": 283996800000 } ] }, { "name": "data_0", "source": "source_0", "transform": [ {"type": "formula", "expr": "toDate(datum[\"Year\"])", "as": "Year"}, { "field": "Year", "type": "timeunit", "units": ["year"], "as": ["year_Year", "year_Year_end"] } ] }, { "name": "data_1", "source": "data_0", "transform": [ {"type": "formula", "expr": "datum[\"ci0\"]", "as": "upper_ci1"}, {"type": "formula", "expr": "datum[\"ci1\"]", "as": "lower_ci1"} ] } ], "marks": [ { "name": "layer_0_layer_0_marks", "type": "area", "style": ["area", "errorband-band"], "sort": {"field": "datum[\"year_Year\"]"}, "from": {"data": "data_1"}, "encode": { "update": { "ariaRoleDescription": {"value": "errorband"}, "opacity": {"value": 0.3}, "orient": {"value": "vertical"}, "fill": {"value": "#4c78a8"}, "tooltip": { "signal": "{\"ci0\": format(datum[\"upper_ci1\"], \"\"), \"ci1\": format(datum[\"lower_ci1\"], \"\"), \"Year (year)\": timeFormat(datum[\"year_Year\"], '%b %d, %Y')}" }, "description": { "signal": "\"Year (year): \" + (timeFormat(datum[\"year_Year\"], '%b %d, %Y')) + \"; Mean of Miles per Gallon (95% CIs): \" + (format(datum[\"lower_ci1\"], \"\")) + \"; upper_ci1: \" + (format(datum[\"upper_ci1\"], \"\")) + \"; ci0: \" + (format(datum[\"upper_ci1\"], \"\")) + \"; ci1: \" + (format(datum[\"lower_ci1\"], \"\"))" }, "x": {"scale": "x", "field": "year_Year"}, "y": {"scale": "y", "field": "lower_ci1"}, "y2": {"scale": "y", "field": "upper_ci1"}, "defined": { "signal": "isValid(datum[\"year_Year\"]) && isFinite(+datum[\"year_Year\"]) && isValid(datum[\"lower_ci1\"]) && isFinite(+datum[\"lower_ci1\"])" } } } }, { "name": "layer_1_marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"year_Year\"]"}, "from": {"data": "data_0"}, "encode": { "update": { "stroke": {"value": "#4c78a8"}, "description": { "signal": "\"Year (year): \" + (timeFormat(datum[\"year_Year\"], timeUnitSpecifier([\"year\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"}))) + \"; center: \" + (format(datum[\"center\"], \"\"))" }, "x": {"scale": "x", "field": "year_Year"}, "y": {"scale": "y", "field": "center"}, "defined": { "signal": "isValid(datum[\"year_Year\"]) && isFinite(+datum[\"year_Year\"]) && isValid(datum[\"center\"]) && isFinite(+datum[\"center\"])" } } } } ], "scales": [ { "name": "x", "type": "time", "domain": { "fields": [ {"data": "data_1", "field": "year_Year"}, {"data": "data_0", "field": "year_Year"} ] }, "range": [0, {"signal": "width"}] }, { "name": "y", "type": "linear", "domain": { "fields": [ {"data": "data_1", "field": "lower_ci1"}, {"data": "data_1", "field": "upper_ci1"}, {"data": "data_0", "field": "center"} ] }, "range": [{"signal": "height"}, 0], "zero": false, "nice": true } ], "axes": [ { "scale": "x", "orient": "bottom", "gridScale": "y", "grid": true, "tickCount": {"signal": "ceil(width/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "y", "orient": "left", "gridScale": "x", "grid": true, "tickCount": {"signal": "ceil(height/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "x", "orient": "bottom", "grid": false, "title": "Year (year)", "format": { "signal": "timeUnitSpecifier([\"year\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})" }, "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "Mean of Miles per Gallon (95% CIs)", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ] }