I've created a scatter plot that is animated:
But I need to add a line plot (just a simple line dividing population of dead and alive patients, but the line needs change every animation_frame). The parameters for the line will be derived from a simple perceptron algorithm.
fig = px.scatter(data_frame=df,
x="neutrophils count",
y="(%)lymphocyte",
color="outcome",
animation_frame="days_from_admission",
color_continuous_scale=["green", "red"],
category_orders={"days_from_admission": [x for x in range(0, 22)]},
labels={"days_from_admission": "Days from admission", "outcome": "Patient outcome:"},
title="Exemplary title")
fig.layout.updatemenus[0].buttons[0].args[1]['frame']['duration'] = 800
fig.layout.updatemenus[0].buttons[0].args[1]['transition']['duration'] = 100
fig.update_layout(title={'x': 0.5, 'xanchor': 'center', 'font': {'size': 20}},
xaxis=dict(title=dict(font=dict(size=20))),
yaxis=dict(title=dict(font=dict(size=20))),
legend={'font': {'size': 18}, 'title': {'font': {'size': 18}}})
#fig.add_vline()
#fig.add_trace()
pio.show(fig)
I know I can add a vline or a trace, but I don't know to how to make it so that it also changes along side animation frames. (For example the vline stays the same on every animation frame, and doesn't accept parameter "animation_frame")
