For the last few days I’ve been playing around with the Manipulate[] function in Mathematica. Basically I wanted to be able to show different combinations of models on the same plot, without having to comment out bits of code all the time.
The result is this:

It took a bit of fiddling to get it right – I started off with all the plot commands inside Manipulate, but it crashed any time I added more than one plot. Eventually it clicked that it would make more sense to create the plots first, and nest the Show[] command in Manipulate instead. You’ll notice that the unticked option is just a transparent version of the same plot – this is probably not very efficient, but it does stop the axes from moving around every time you check or uncheck a box.
Anyway, here’s the code:
tmax = 50;
h01 = Plot[t, {t, 0, tmax}, PlotRange -> All, PlotStyle -> Transparent];h1 = Plot[t, {t, 0, tmax}, PlotRange -> All];h02 = Plot[2*t, {t, 0, tmax}, PlotRange -> All, PlotStyle -> Transparent];h2 = Plot[2*t, {t, 0, tmax}, PlotRange -> All];h03 = Plot[3*t, {t, 0, tmax}, PlotRange -> All, PlotStyle -> Transparent];h3 = Plot[3*t, {t, 0, tmax}, PlotRange -> All];h04 = Plot[4*t, {t, 0, tmax}, PlotRange -> All, PlotStyle -> Transparent];h4 = Plot[4*t, {t, 0, tmax}, PlotRange -> All];
Manipulate[ Show[g1, g2, g3, g4, PlotRange -> All, PlotLabel -> "Manipulate Example"], {{g1, h1, “h1″}, {h01, h1}}, {{g2, h2, “h2″}, {h02, h2}}, {{g3, h3, “h3″}, {h03, h3}}, {{g4, h4, “h4″}, {h04, h4}}, ControlType -> Checkbox]