VegaliteTooltip({
'$schema': 'https://vega.github.io/schema/vega-lite/v2.json',
'title': 'Refugee immigration to US from travel ban countries (Iran, Libya, Somalia, Sudan, Syria, and Yemen)',
'width': 800, 'height': 300,
'layer': [
{
'data': {'values': timeline},
'transform': [{
'filter': 'datum.Day >= datetime(2012, 1, 1) && indexof(["Christian", "Muslim"], datum.Religion) != -1 && indexof(["Somalia", "Libya", "Iran", "Sudan", "Syria", "Yemen"], datum.Country) != -1',
}],
'mark': 'line',
'encoding': {
'x': {
'timeUnit': 'yearmonth', 'field': 'Day', 'type': 'temporal',
'axis': {'domain': false, 'tickSize': 0, 'title': 'Day'}
},
'y': {
'aggregate': 'sum', 'field': 'Count','type': 'quantitative', 'name': 'Total arrivals',
'axis': {'domain': false, 'title': 'Total arrivals'},
},
'color': {'field': 'Religion', 'type': 'nominal'}
},
},
{
'data': {'values': [
{'Day': '2017-01-20', 'Label': '← Trump enters office'},
]},
'layer': [
{
'mark': 'rule',
'encoding': {
'x': {
'timeUnit': 'yearmonth', 'field': 'Day', 'type': 'temporal',
'aggregate': 'min',
'axis': null,
},
'size': {'value': 2},
'color': {'value': 'black',}
},
},
{
'mark': {
'type': 'text',
'align': 'left',
'baseline': 'top',
'dy': -62,
'dx': 10,
},
'encoding': {
'x': {
'timeUnit': 'yearmonth', 'field': 'Day', 'type': 'temporal',
'aggregate': 'min',
'axis': null,
},
'text': {'field': 'Label', 'type': 'nominal'},
'color': {'value': 'black',}
},
},
],
},
],
})