{
const selectIntervalBrush = vl.selectInterval();
const temporalCirclePlot = vl.markCircle()
.select(selectIntervalBrush)
.title({text: "Daily Max Temperatures in Seattle 2012 - 2015",
subtitle: "Drag to select points | Click elsewhere to deselect"})
.encode(
vl.x().fieldT("date").timeUnit('monthdate')
.axis({"format": "%b"})
.title("Aggregated Months (2012-2015)"),
vl.y().fieldQ('temp_max').title('Max Temp'),
vl.color().value("lightgray").if(
selectIntervalBrush,
vl.color().fieldN('weather').scale({range: weatherPalette})),
vl.size().fieldQ('precipitation').scale({range:[5, 350]})
).width(width - 200);
const weatherFreqBarPlot = vl.markBar()
.transform(vl.filter(selectIntervalBrush))
.encode(
vl.x().count()
.title('Num of Days with Weather (2012-2015)')
.scale({ domain: [0, 1600] }),
vl.y().fieldN('weather')
.scale({ domain: ["drizzle", "fog", "rain", "snow", "sun"]}),
vl.color().fieldN('weather').scale({range: weatherPalette})
).width(width - 200);
return vl.vconcat(temporalCirclePlot, weatherFreqBarPlot)
.data(seattleWeatherTyped)
.render();
}