{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "height": 200, "data": [ { "name": "source_0", "url": "data/weather.csv", "format": {"type": "csv", "parse": {"date": "date"}}, "transform": [ { "field": "date", "type": "timeunit", "units": ["month"], "as": ["month_date", "month_date_end"] }, { "type": "aggregate", "groupby": ["month_date", "location"], "ops": ["mean", "mean", "mean"], "fields": ["precipitation", "wind", "temp_max"], "as": ["mean_precipitation", "mean_wind", "mean_temp_max"] } ] } ], "signals": [{"name": "childWidth", "value": 200}], "layout": {"padding": 20, "bounds": "full", "align": "all"}, "marks": [ { "type": "group", "name": "child__temp_max_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "height"} } }, "marks": [ { "name": "child__temp_max_pathgroup", "type": "group", "from": { "facet": { "name": "faceted_path_child__temp_max_main", "data": "source_0", "groupby": ["location"] } }, "encode": { "update": { "width": {"field": {"group": "width"}}, "height": {"field": {"group": "height"}} } }, "marks": [ { "name": "child__temp_max_marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"month_date\"]"}, "from": {"data": "faceted_path_child__temp_max_main"}, "encode": { "update": { "stroke": {"scale": "color", "field": "location"}, "description": { "signal": "\"date (month): \" + (timeFormat(datum[\"month_date\"], timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"}))) + \"; Mean of temp_max: \" + (format(datum[\"mean_temp_max\"], \"\")) + \"; location: \" + (isValid(datum[\"location\"]) ? datum[\"location\"] : \"\"+datum[\"location\"])" }, "x": {"scale": "child__temp_max_x", "field": "month_date"}, "y": {"scale": "child__temp_max_y", "field": "mean_temp_max"}, "defined": { "signal": "isValid(datum[\"month_date\"]) && isFinite(+datum[\"month_date\"]) && isValid(datum[\"mean_temp_max\"]) && isFinite(+datum[\"mean_temp_max\"])" } } } } ] } ], "axes": [ { "scale": "child__temp_max_x", "orient": "bottom", "gridScale": "child__temp_max_y", "grid": true, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__temp_max_y", "orient": "left", "gridScale": "child__temp_max_x", "grid": true, "tickCount": {"signal": "ceil(height/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__temp_max_x", "orient": "bottom", "grid": false, "title": "date (month)", "format": { "signal": "timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})" }, "labelFlush": true, "labelOverlap": true, "zindex": 0 }, { "scale": "child__temp_max_y", "orient": "left", "grid": false, "title": "Mean of temp_max", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__precipitation_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "height"} } }, "marks": [ { "name": "child__precipitation_pathgroup", "type": "group", "from": { "facet": { "name": "faceted_path_child__precipitation_main", "data": "source_0", "groupby": ["location"] } }, "encode": { "update": { "width": {"field": {"group": "width"}}, "height": {"field": {"group": "height"}} } }, "marks": [ { "name": "child__precipitation_marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"month_date\"]"}, "from": {"data": "faceted_path_child__precipitation_main"}, "encode": { "update": { "stroke": {"scale": "color", "field": "location"}, "description": { "signal": "\"date (month): \" + (timeFormat(datum[\"month_date\"], timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"}))) + \"; Mean of precipitation: \" + (format(datum[\"mean_precipitation\"], \"\")) + \"; location: \" + (isValid(datum[\"location\"]) ? datum[\"location\"] : \"\"+datum[\"location\"])" }, "x": { "scale": "child__precipitation_x", "field": "month_date" }, "y": { "scale": "child__precipitation_y", "field": "mean_precipitation" }, "defined": { "signal": "isValid(datum[\"month_date\"]) && isFinite(+datum[\"month_date\"]) && isValid(datum[\"mean_precipitation\"]) && isFinite(+datum[\"mean_precipitation\"])" } } } } ] } ], "axes": [ { "scale": "child__precipitation_x", "orient": "bottom", "gridScale": "child__precipitation_y", "grid": true, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__precipitation_y", "orient": "left", "gridScale": "child__precipitation_x", "grid": true, "tickCount": {"signal": "ceil(height/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__precipitation_x", "orient": "bottom", "grid": false, "title": "date (month)", "format": { "signal": "timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})" }, "labelFlush": true, "labelOverlap": true, "zindex": 0 }, { "scale": "child__precipitation_y", "orient": "left", "grid": false, "title": "Mean of precipitation", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__wind_group", "style": "cell", "encode": { "update": { "width": {"signal": "childWidth"}, "height": {"signal": "height"} } }, "marks": [ { "name": "child__wind_pathgroup", "type": "group", "from": { "facet": { "name": "faceted_path_child__wind_main", "data": "source_0", "groupby": ["location"] } }, "encode": { "update": { "width": {"field": {"group": "width"}}, "height": {"field": {"group": "height"}} } }, "marks": [ { "name": "child__wind_marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"month_date\"]"}, "from": {"data": "faceted_path_child__wind_main"}, "encode": { "update": { "stroke": {"scale": "color", "field": "location"}, "description": { "signal": "\"date (month): \" + (timeFormat(datum[\"month_date\"], timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"}))) + \"; Mean of wind: \" + (format(datum[\"mean_wind\"], \"\")) + \"; location: \" + (isValid(datum[\"location\"]) ? datum[\"location\"] : \"\"+datum[\"location\"])" }, "x": {"scale": "child__wind_x", "field": "month_date"}, "y": {"scale": "child__wind_y", "field": "mean_wind"}, "defined": { "signal": "isValid(datum[\"month_date\"]) && isFinite(+datum[\"month_date\"]) && isValid(datum[\"mean_wind\"]) && isFinite(+datum[\"mean_wind\"])" } } } } ] } ], "axes": [ { "scale": "child__wind_x", "orient": "bottom", "gridScale": "child__wind_y", "grid": true, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__wind_y", "orient": "left", "gridScale": "child__wind_x", "grid": true, "tickCount": {"signal": "ceil(height/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__wind_x", "orient": "bottom", "grid": false, "title": "date (month)", "format": { "signal": "timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})" }, "labelFlush": true, "labelOverlap": true, "zindex": 0 }, { "scale": "child__wind_y", "orient": "left", "grid": false, "title": "Mean of wind", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ] } ], "scales": [ { "name": "color", "type": "ordinal", "domain": {"data": "source_0", "field": "location", "sort": true}, "range": "category" }, { "name": "child__temp_max_x", "type": "time", "domain": {"data": "source_0", "field": "month_date"}, "range": [0, {"signal": "childWidth"}] }, { "name": "child__temp_max_y", "type": "linear", "domain": {"data": "source_0", "field": "mean_temp_max"}, "range": [{"signal": "height"}, 0], "nice": true, "zero": true }, { "name": "child__precipitation_x", "type": "time", "domain": {"data": "source_0", "field": "month_date"}, "range": [0, {"signal": "childWidth"}] }, { "name": "child__precipitation_y", "type": "linear", "domain": {"data": "source_0", "field": "mean_precipitation"}, "range": [{"signal": "height"}, 0], "nice": true, "zero": true }, { "name": "child__wind_x", "type": "time", "domain": {"data": "source_0", "field": "month_date"}, "range": [0, {"signal": "childWidth"}] }, { "name": "child__wind_y", "type": "linear", "domain": {"data": "source_0", "field": "mean_wind"}, "range": [{"signal": "height"}, 0], "nice": true, "zero": true } ], "legends": [{"stroke": "color", "symbolType": "stroke", "title": "location"}] }