Created
September 21, 2024 06:20
-
-
Save razhangwei/4fafdae383147c10af465f89f8864293 to your computer and use it in GitHub Desktop.
pyplot express example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create an interactive bar chart with two bars per date | |
fig = go.Figure() | |
fig.add_trace(go.Bar( | |
x=daily_formula_intake.index, | |
y=daily_formula_intake.values, | |
name='Formula' | |
)) | |
fig.add_trace(go.Bar( | |
x=daily_expressed_intake.index, | |
y=daily_expressed_intake.values, | |
name='Expressed' | |
)) | |
# Add linear regression line | |
fig.add_trace(go.Scatter( | |
x=daily_total_intake.index, | |
y=y_pred, | |
mode='lines', | |
name='Linear Regression' | |
)) | |
fig.update_layout( | |
title='Daily Total Milk Intake (Formula + Expressed)', | |
xaxis_title='Date', | |
yaxis_title='Total Amount (ml)', | |
barmode='stack' # Stack the bars for formula and expressed | |
) | |
fig.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment