For faceting, we can use facet inside $encode(). The height and width we specify, refer to each individual plot. If we do not specify the number of columns columns = 3 all individual charts are concatenated horizontally. We also see that with the facet function, a title of each chart is automatically displayed for each level of the variable we are faceting.

chart_disasters = alt$Chart(data_source_modified)$
  mark_circle(
    opacity = 0.8,
    size = 20
  )$
  encode(
    x = 'Year:O',
    y = 'Missing:N',
    color = 'Missing:N',
    facet = alt$Facet('Entity:N', columns = 3),
    tooltip = "Year:Q"
  )$
  properties(
    width = 180,
    height = 90
  )$
  interactive()


Exercise - Make a faceted chart for the time series per natural disaster.

Exercise - What is the problem with the chart made above and how could you remake it without using facet?