I've been stuck for a long time on this problem, and I really would appreciate if somebody helps me move in the right direction.
I have two functions and each can take one of two forms. I am interested in seeing the sum of these functions. I would like to see a single plot all the time instead of the configuration I show in the code posted below. I want two checkboxes (one for AU and one for TU. If one of these boxes is checked, then I want to be able to choose with radio buttons which form (AU1 or AU2) is plotted. So my Manipulate
should have two check boxes and beneath of each two radio buttons. The plot should always show the functions if both check boxes are checked. For example, if AU1 and TU2 are checked, I want to see AU1 + TU2, but if TU is not checked, I only want to see AU1. The radio buttons select which form of of AU or TU is used to form the sum when both functions are checked.
Is my problem with Control@...
? I tried things like:
Style[Control@{{x, 1, ""}, {3 -> "AU1", 1 -> "AU2"}, ControlType -> RadioButtonBar}, Blue]
but that didn't get me anywhere.
I think there are two things:
- I need to rethink the structure I built with
If
expressions. - I need to know how to build a structure with checked check boxes being able to enable and disable radio buttons.
Here is my code and an image:
Manipulate[
Show[
If[f11, {Plot[ ( Exp[-p]), {p, 0, 1},
PlotStyle -> {Thickness[0.006], Red}, PlotPoints -> 200,
AxesLabel -> {p, U}]}, {}],
If[f12, {Plot[ (3 *p), {p, 0, 1},
PlotStyle -> {Thickness[0.006], Red}, PlotPoints -> 200,
AxesLabel -> {p, U}]}, {}],
If[f21, {Plot[ (-4) (p - 3), {p, 0, 1},
PlotStyle -> {Thickness[0.006], Green}, PlotPoints -> 200,
AxesLabel -> {p, U}]}, {}],
If[f22, {Plot[3, {p, 0, 1}, PlotStyle -> {Thickness[0.006], Green},
PlotPoints -> 200,
AxesLabel -> {p, U}]}, {}],
If[f41, {Plot[ Exp[-p] + (-4) (p - 3), {p, 0, 1},
PlotStyle -> {Thickness[0.006], Orange}, PlotPoints -> 200,
AxesLabel -> {p, U}]}, {}],
If[f42, {Plot[ (3 *p) + (-4) (p - 3), {p, 0, 1},
PlotStyle -> {Thickness[0.006], Orange}, PlotPoints -> 200,
AxesLabel -> {p, U}]}, {}],
If[f51, {Plot[( Exp[-p]) + 3 , {p, 0, 1},
PlotStyle -> {Thickness[0.006], Blue}, PlotPoints -> 200,
AxesLabel -> {p, U}]}, {}],
If[f52, {Plot[ (3 *p) + 3, {p, 0, 1},
PlotStyle -> {Thickness[0.006], Blue}, PlotPoints -> 200,
AxesLabel -> {p, U}]}, {}],
PlotRange -> All, ImageSize -> 450],
{{f11, False, Style["(AU_1)", 12, Bold, Red]}, {True, False}},
{{f12, False, Style["(AU_2)", 12, Bold, Red]}, {True, False}},
{{f21, False, Style["(TU_1)", 12, Bold, Green]}, {True, False}},
{{f22, True, Style["(TU_2)", 12, Bold, Green]}, {True, False}},
{{f41, True, Style["(AU_1 + TU_1)", 12, Bold, Orange]}, {True,False}},
{{f42, False, Style["(AU_2 + TU_1)", 12, Bold, Orange]}, {True,False}},
{{f51, False, Style["(AU_1 + TU_2)", 12, Bold, Blue]}, {True, False}},
{{f52, False, Style["(AU_2 + TU_2)", 12, Bold, Blue]}, {True, False}},
AppearanceElements -> "ResetButton",
ControlPlacement -> Left]