How to plot the solution of two different (but almost identical) differential equations on same plot?

Hello,

I have two differential equations which calculate how much area a fleet of boats can cover. The two equations are nearly identical apart from how the area coverage is calculated. I would like to graph the outcomes of the two equations onto one plot.

I can plot them separately but cannot find in the documentation how to do it together.

The p changes between the two in that one of the parameters is a different function. All other parameters stay the same.

static_prob = ODEProblem(dBdT,bioS,tspan,p)
static = solve(static_prob)

boom_prob = ODEProblem(dBdT,bioS,tspan,p)
boom_sol = solve(boom_prob)

plot(static_sol, vars = ((num_nutrient+num_plant+num_animal+num_vessel_types)), tspan=(0.0,tmax), title = "Static - Vessel biomass $target_species", xlabel = "Time" ,ylabel = "Biomass", lw=0.3)
plot(boom_sol, vars = ((num_nutrient+num_plant+num_animal+num_vessel_types)), tspan=(0.0,tmax), title = "Boom-Bust - Vessel biomass $target_species", xlabel = "Time" ,ylabel = "Biomass", lw=0.3)

This produces

I would really like to have them on one plot!

Does anyone have suggestions?

You’re looking for plot!(...) - note the !, which indicates that the command changes the current plot object rather than producing a new plot.

3 Likes

Of course! Thanks :slight_smile:

I feel very silly now.

1 Like