{ "$schema": "https://vega.github.io/schema/vega/v5.json", "description": "Summarized and per year weather information for Seatle and New York.", "background": "white", "padding": 5, "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"] }, { "field": "date", "type": "timeunit", "units": ["year"], "as": ["year_date", "year_date_end"] } ] }, { "name": "data_0", "source": "source_0", "transform": [ { "type": "aggregate", "groupby": ["month_date", "location"], "ops": ["mean", "mean", "mean"], "fields": ["precipitation", "wind", "temp_max"], "as": ["mean_precipitation", "mean_wind", "mean_temp_max"] } ] }, { "name": "data_1", "source": "source_0", "transform": [ { "type": "aggregate", "groupby": ["month_date", "location", "year_date"], "ops": ["mean", "mean", "mean"], "fields": ["wind", "temp_max", "precipitation"], "as": ["mean_wind", "mean_temp_max", "mean_precipitation"] } ] } ], "signals": [ {"name": "childHeight", "value": 200}, {"name": "child__column_temp_max_x_step", "value": 20}, { "name": "child__column_temp_max_width", "update": "bandspace(domain('child__column_temp_max_x').length, 1, 0.5) * child__column_temp_max_x_step" }, {"name": "child__column_precipitation_x_step", "value": 20}, { "name": "child__column_precipitation_width", "update": "bandspace(domain('child__column_precipitation_x').length, 1, 0.5) * child__column_precipitation_x_step" }, {"name": "child__column_wind_x_step", "value": 20}, { "name": "child__column_wind_width", "update": "bandspace(domain('child__column_wind_x').length, 1, 0.5) * child__column_wind_x_step" } ], "layout": {"padding": 20, "columns": 3, "bounds": "full", "align": "all"}, "marks": [ { "type": "group", "name": "child__column_temp_max_group", "style": "cell", "encode": { "update": { "width": {"signal": "child__column_temp_max_width"}, "height": {"signal": "childHeight"} } }, "marks": [ { "name": "child__column_temp_max_layer_0_pathgroup", "type": "group", "from": { "facet": { "name": "faceted_path_child__column_temp_max_layer_0_main", "data": "data_1", "groupby": ["location", "year_date"] } }, "encode": { "update": { "width": {"field": {"group": "width"}}, "height": {"field": {"group": "height"}} } }, "marks": [ { "name": "child__column_temp_max_layer_0_marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"month_date\"]"}, "from": { "data": "faceted_path_child__column_temp_max_layer_0_main" }, "encode": { "update": { "stroke": {"scale": "color", "field": "location"}, "opacity": {"value": 0.2}, "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\"]) + \"; date (year): \" + (timeFormat(datum[\"year_date\"], timeUnitSpecifier([\"year\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})))" }, "x": { "scale": "child__column_temp_max_x", "field": "month_date" }, "y": { "scale": "child__column_temp_max_y", "field": "mean_temp_max" }, "defined": { "signal": "isValid(datum[\"mean_temp_max\"]) && isFinite(+datum[\"mean_temp_max\"])" } } } } ] }, { "name": "child__column_temp_max_layer_1_pathgroup", "type": "group", "from": { "facet": { "name": "faceted_path_child__column_temp_max_layer_1_main", "data": "data_0", "groupby": ["location"] } }, "encode": { "update": { "width": {"field": {"group": "width"}}, "height": {"field": {"group": "height"}} } }, "marks": [ { "name": "child__column_temp_max_layer_1_marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"month_date\"]"}, "from": { "data": "faceted_path_child__column_temp_max_layer_1_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__column_temp_max_x", "field": "month_date" }, "y": { "scale": "child__column_temp_max_y", "field": "mean_temp_max" }, "defined": { "signal": "isValid(datum[\"mean_temp_max\"]) && isFinite(+datum[\"mean_temp_max\"])" } } } } ] } ], "axes": [ { "scale": "child__column_temp_max_y", "orient": "left", "gridScale": "child__column_temp_max_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__column_temp_max_x", "orient": "bottom", "grid": false, "title": "date (month)", "format": { "signal": "timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})" }, "formatType": "time", "labelOverlap": true, "zindex": 0 }, { "scale": "child__column_temp_max_y", "orient": "left", "grid": false, "title": "Mean of temp_max", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__column_precipitation_group", "style": "cell", "encode": { "update": { "width": {"signal": "child__column_precipitation_width"}, "height": {"signal": "childHeight"} } }, "marks": [ { "name": "child__column_precipitation_layer_0_pathgroup", "type": "group", "from": { "facet": { "name": "faceted_path_child__column_precipitation_layer_0_main", "data": "data_1", "groupby": ["location", "year_date"] } }, "encode": { "update": { "width": {"field": {"group": "width"}}, "height": {"field": {"group": "height"}} } }, "marks": [ { "name": "child__column_precipitation_layer_0_marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"month_date\"]"}, "from": { "data": "faceted_path_child__column_precipitation_layer_0_main" }, "encode": { "update": { "stroke": {"scale": "color", "field": "location"}, "opacity": {"value": 0.2}, "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\"]) + \"; date (year): \" + (timeFormat(datum[\"year_date\"], timeUnitSpecifier([\"year\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})))" }, "x": { "scale": "child__column_precipitation_x", "field": "month_date" }, "y": { "scale": "child__column_precipitation_y", "field": "mean_precipitation" }, "defined": { "signal": "isValid(datum[\"mean_precipitation\"]) && isFinite(+datum[\"mean_precipitation\"])" } } } } ] }, { "name": "child__column_precipitation_layer_1_pathgroup", "type": "group", "from": { "facet": { "name": "faceted_path_child__column_precipitation_layer_1_main", "data": "data_0", "groupby": ["location"] } }, "encode": { "update": { "width": {"field": {"group": "width"}}, "height": {"field": {"group": "height"}} } }, "marks": [ { "name": "child__column_precipitation_layer_1_marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"month_date\"]"}, "from": { "data": "faceted_path_child__column_precipitation_layer_1_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__column_precipitation_x", "field": "month_date" }, "y": { "scale": "child__column_precipitation_y", "field": "mean_precipitation" }, "defined": { "signal": "isValid(datum[\"mean_precipitation\"]) && isFinite(+datum[\"mean_precipitation\"])" } } } } ] } ], "axes": [ { "scale": "child__column_precipitation_y", "orient": "left", "gridScale": "child__column_precipitation_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__column_precipitation_x", "orient": "bottom", "grid": false, "title": "date (month)", "format": { "signal": "timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})" }, "formatType": "time", "labelOverlap": true, "zindex": 0 }, { "scale": "child__column_precipitation_y", "orient": "left", "grid": false, "title": "Mean of precipitation", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] }, { "type": "group", "name": "child__column_wind_group", "style": "cell", "encode": { "update": { "width": {"signal": "child__column_wind_width"}, "height": {"signal": "childHeight"} } }, "marks": [ { "name": "child__column_wind_layer_0_pathgroup", "type": "group", "from": { "facet": { "name": "faceted_path_child__column_wind_layer_0_main", "data": "data_1", "groupby": ["location", "year_date"] } }, "encode": { "update": { "width": {"field": {"group": "width"}}, "height": {"field": {"group": "height"}} } }, "marks": [ { "name": "child__column_wind_layer_0_marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"month_date\"]"}, "from": {"data": "faceted_path_child__column_wind_layer_0_main"}, "encode": { "update": { "stroke": {"scale": "color", "field": "location"}, "opacity": {"value": 0.2}, "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\"]) + \"; date (year): \" + (timeFormat(datum[\"year_date\"], timeUnitSpecifier([\"year\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})))" }, "x": {"scale": "child__column_wind_x", "field": "month_date"}, "y": {"scale": "child__column_wind_y", "field": "mean_wind"}, "defined": { "signal": "isValid(datum[\"mean_wind\"]) && isFinite(+datum[\"mean_wind\"])" } } } } ] }, { "name": "child__column_wind_layer_1_pathgroup", "type": "group", "from": { "facet": { "name": "faceted_path_child__column_wind_layer_1_main", "data": "data_0", "groupby": ["location"] } }, "encode": { "update": { "width": {"field": {"group": "width"}}, "height": {"field": {"group": "height"}} } }, "marks": [ { "name": "child__column_wind_layer_1_marks", "type": "line", "style": ["line"], "sort": {"field": "datum[\"month_date\"]"}, "from": {"data": "faceted_path_child__column_wind_layer_1_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__column_wind_x", "field": "month_date"}, "y": {"scale": "child__column_wind_y", "field": "mean_wind"}, "defined": { "signal": "isValid(datum[\"mean_wind\"]) && isFinite(+datum[\"mean_wind\"])" } } } } ] } ], "axes": [ { "scale": "child__column_wind_y", "orient": "left", "gridScale": "child__column_wind_x", "grid": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "child__column_wind_x", "orient": "bottom", "grid": false, "title": "date (month)", "format": { "signal": "timeUnitSpecifier([\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})" }, "formatType": "time", "labelOverlap": true, "zindex": 0 }, { "scale": "child__column_wind_y", "orient": "left", "grid": false, "title": "Mean of wind", "labelOverlap": true, "tickCount": {"signal": "ceil(childHeight/40)"}, "zindex": 0 } ] } ], "scales": [ { "name": "color", "type": "ordinal", "domain": { "fields": [ {"data": "data_1", "field": "location"}, {"data": "data_0", "field": "location"} ], "sort": true }, "range": "category" }, { "name": "child__column_temp_max_x", "type": "point", "domain": { "fields": [ {"data": "data_1", "field": "month_date"}, {"data": "data_0", "field": "month_date"} ], "sort": true }, "range": {"step": {"signal": "child__column_temp_max_x_step"}}, "padding": 0.5 }, { "name": "child__column_temp_max_y", "type": "linear", "domain": { "fields": [ {"data": "data_1", "field": "mean_temp_max"}, {"data": "data_0", "field": "mean_temp_max"} ] }, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__column_precipitation_x", "type": "point", "domain": { "fields": [ {"data": "data_1", "field": "month_date"}, {"data": "data_0", "field": "month_date"} ], "sort": true }, "range": {"step": {"signal": "child__column_precipitation_x_step"}}, "padding": 0.5 }, { "name": "child__column_precipitation_y", "type": "linear", "domain": { "fields": [ {"data": "data_1", "field": "mean_precipitation"}, {"data": "data_0", "field": "mean_precipitation"} ] }, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true }, { "name": "child__column_wind_x", "type": "point", "domain": { "fields": [ {"data": "data_1", "field": "month_date"}, {"data": "data_0", "field": "month_date"} ], "sort": true }, "range": {"step": {"signal": "child__column_wind_x_step"}}, "padding": 0.5 }, { "name": "child__column_wind_y", "type": "linear", "domain": { "fields": [ {"data": "data_1", "field": "mean_wind"}, {"data": "data_0", "field": "mean_wind"} ] }, "range": [{"signal": "childHeight"}, 0], "nice": true, "zero": true } ], "legends": [ { "stroke": "color", "symbolType": "stroke", "title": "location", "encode": {"symbols": {"update": {"opacity": {"value": 0.2}}}} } ] }