Question: How to Arrange Multiple Plots in a Grid Layout

I am working on visualizing the results of an SIR model in Maple. I’ve created multiple plots for different parameter values using dsolve and odeplot, and I’d like to arrange them in a grid (e.g., 2 rows x 3 columns) for easier comparison. Here’s what I’ve tried:

restart; with(plots); n := 10^6; s__0 := n-1; i__0 := 1; r__0 := 0; simulate_SIR := proc (beta, gamma) local lambda, sys, ic, sols, single_plot; lambda := beta*i(t)/n; sys := diff(s(t), t) = -lambda*s(t), diff(i(t), t) = lambda*s(t)-gamma*i(t), diff(r(t), t) = gamma*i(t); ic := s(0) = s__0, i(0) = i__0, r(0) = r__0; sols := dsolve({sys, ic}, numeric, output = listprocedure); single_plot := display([odeplot(sols, [t, s(t)], 0 .. 60, color = red), odeplot(sols, [t, i(t)], 0 .. 60, color = blue), odeplot(sols, [t, r(t)], 0 .. 60, color = green)], labels = ["Time [day]", "Population"], labeldirections = [horizontal, vertical], legend = ["Susceptible", "Infected", "Recovered"], legendstyle = [location = right]); return single_plot end proc; plot1 := simulate_SIR(.1, .1); plot2 := simulate_SIR(.2, .1); plot3 := simulate_SIR(.7, .1); plot4 := simulate_SIR(1.5, .1); plot5 := simulate_SIR(1, 0.25e-1); plot6 := simulate_SIR(1, .2); plot7 := simulate_SIR(1, .5); plot8 := simulate_SIR(1, 1); combined_plot := display([plot1, plot2, plot3, plot4, plot5, plot6, plot7, plot8], insequence = true, view = [0 .. 60, 0 .. n], grid = [2, 4]); combined_plot

 
 

NULL

Download grid.mw

Unfortunately, the insequence=true and gird=[2, 4] options didn’t work as I expected. Instead of arranging the plots in a grid, they appear like an animation

How can I correctly arrange multiple plots into a grid layout in Maple? Are there specific options or steps I’m missing? I would appreciate any guidance or examples.

Please Wait...