简体   繁体   中英

Return a several traces plot in dash

I have a basic SIR model in python for which I want to make a dash app. The original plot I have looks like this:

在此处输入图片说明

Currently I'm able to create a dash plot that looks like this:

在此处输入图片说明

This issue with this is that I´m able to send only onde of the plot traces, for which I use the following code in the callback method:

s, e, i, r,x = seir_model(h,transmission_coeff,latency_time,infectious_time,end_time,
          initial_s,initial_e,initial_i,initial_r)



return {"data":[go.Scatter(x=x,
                y=s)]}

How can I add the rest of the vector: e, i, r to that plot?

You can simpy pass list of traces to "data", like this:

return {"data":[go.Scatter(x=x,y=s),
                go.Scatter(x=x,y=i),
                go.Scatter(x=x,y=r),
                go.Scatter(x=x,y=e)]}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM