Calmcode - altair: line chart

How to Create Line Charts with Color in Altair.

1 2 3 4 5 6 7 8 9

Making a Line Chart in Altair

Besides making scatter charts we can also configure altair to generate line charts. Note that the properties remain the same.

The final plot is created via;

days = ['Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat', 'Sun']

(alt.Chart(plot_df)
  .mark_line()
  .encode(x='date', y='births', color=alt.Color('wday', sort=days))
  .properties(width=600, height=250)
  .interactive())