fig = px.line(filtered_df, x="CHEM_DATE", y=selected_indicator, color="INJECTION_POINT", title=f"{selected_indicator} en fonction du temps", labels={"CHEM_DATE": "Date", selected_indicator: "Valeur"}, template="plotly_dark") st.plotly_chart(fig)
To upload files, please first save the app
import streamlit as st
import pandas as pd
import plotly.express as px
import numpy as np
# Create sample data
dates = pd.date_range(start='2023-01-01', end='2023-12-31', freq='D')
injection_points = ['Point A', 'Point B', 'Point C']
data = []
for point in injection_points:
for date in dates:
value = np.random.normal(100, 10) # Random value with some noise
data.append({
'CHEM_DATE': date,
'INJECTION_POINT': point,
'Indicator': value
})
df = pd.DataFrame(data)
# Streamlit app
st.title('Chemical Injection Analysis')
# Sidebar for filtering
selected_indicator = 'Indicator'
# Create the line plot
fig = px.line(df,
x="CHEM_DATE",
y=selected_indicator,
color="INJECTION_POINT",
title=f"{selected_indicator} en fonction du temps",
labels={"CHEM_DATE": "Date", selected_indicator: "Valeur"},
template="plotly_dark")
# Display the plot
st.plotly_chart(fig, use_container_width=True)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?