Plot multiple line chart in a single line chart

Hi @Sanniddha

Is this what you mean:

import streamlit as st
import pandas as pd
import plotly.express as px

stock = pd.DataFrame({
    'ds': ['2024-01-01', '2024-01-02', '2024-01-03'],
    'y': [10, 15, 12]
})

prediction = pd.DataFrame({
    'ds': ['2024-01-01', '2024-01-02', '2024-01-03'],
    'y': [12, 14, 16]
})

fig = px.line(stock, x="ds", y="y", color_discrete_sequence=["#0514C0"], labels={'y': 'Stock'})
fig.add_scatter(x=prediction['ds'], y=prediction['y'], mode='lines', name='Prediction', line=dict(color='#4CC005'))

fig.update_layout(title='Stock vs Prediction', xaxis_title='Date', yaxis_title='Value')

st.plotly_chart(fig, use_container_width=True)

Recording 2024-04-05 at 13.22.03

Best,
Charly