2

I have some time series data. I'm comparing 2 different series (predictions vs actual for a machine learning model). I have a line chart with both lines, but I can't figure out how to change the color of the lines, as all examples I see rely on organizing the data in a completely different way.

This is what my code looks like.

source = df

line1 = alt.Chart(source).mark_line().encode(
    x='Date', 
    y='y_preds'
)

line2 = alt.Chart(source).mark_line().encode(
    x='Date', 
    y='y_actual'
)

line1 + line2

How could I color one of the lines red without reorganizing all the data?

Ragnar Lothbrok
  • 1,045
  • 2
  • 16
  • 31

1 Answers1

4

Try this:

alt.Chart(df).mark_line().encode(
  x='x',
  y='y',
  color=alt.value("#FFAA00")
)
RAVI KUMAR
  • 386
  • 1
  • 12