I'm trying to make the next simple interactive plot:
Needs["PlotLegends`"]
rTE[\[Theta]_, n1_, n2_] :=
Abs[(n1*Cos[\[Theta]] -
n2*Cos[ArcSin[n1*Sin[\[Theta]]/n2]])/(n1*Cos[\[Theta]] +
n2*Cos[ArcSin[n1*Sin[\[Theta]]/n2]])]
rTM[\[Theta]_, n1_, n2_] :=
Abs[(n2*Cos[\[Theta]] -
n1*Cos[ArcSin[n1*Sin[\[Theta]]/n2]])/(n2*Cos[\[Theta]] +
n1*Cos[ArcSin[n1*Sin[\[Theta]]/n2]])]
tTE[\[Theta]_, n1_, n2_] :=
Abs[(2*n1*Cos[\[Theta]])/(n1*Cos[\[Theta]] +
n2*Cos[ArcSin[n1*Sin[\[Theta]]/n2]])]
tTM[\[Theta]_, n1_, n2_] :=
Abs[(2*n1*Cos[\[Theta]])/(n2*Cos[\[Theta]] +
n1*Cos[ArcSin[n1*Sin[\[Theta]]/n2]])]
RTE[\[Theta]_, n1_, n2_] := Abs[(rTE[\[Theta], n1, n2])^2]
RTM[\[Theta]_, n1_, n2_] := Abs[(rTM[\[Theta], n1, n2])^2]
TTE[\[Theta]_, n1_, n2_] :=
Abs[(tTE[\[Theta], n1, n2])^2*(n2*
Cos[ArcSin[n1*Sin[\[Theta]]/n2]])/(n1*Cos[\[Theta]])]
TTM[\[Theta]_, n1_, n2_] :=
Abs[(tTM[\[Theta], n1, n2])^2*(n2*
Cos[ArcSin[n1*Sin[\[Theta]]/n2]])/(n1*Cos[\[Theta]])]
Manipulate[
GraphicsRow[{Plot[{rTM[\[Theta], n1, n2], rTE[\[Theta], n1, n2],
tTM[\[Theta], n1, n2], tTE[\[Theta], n1, n2]}, {\[Theta],
0, \[Pi]/2}, PlotStyle -> Thick,
PlotLegend -> {"rTM[\[Theta]]" , "rTE[\[Theta]]",
"tTM[\[Theta]]" , "tTE[\[Theta]]"}, LegendPosition -> {1, -0.4},
PlotMarkers -> Automatic, AxesLabel -> Automatic,
PlotRange -> {0, 1}],
Plot[{RTM[\[Theta], n1, n2], RTE[\[Theta], n1, n2],
TTM[\[Theta], n1, n2], TTE[\[Theta], n1, n2]}, {\[Theta],
0, \[Pi]/2}, PlotStyle -> Thick,
PlotLegend -> {"RTM[\[Theta]]" , "RTE[\[Theta]]",
"TTM[\[Theta]]" , "TTE[\[Theta]]"}, LegendPosition -> {1, -0.4},
PlotMarkers -> Automatic, AxesLabel -> Automatic,
PlotRange -> {0, 1}]}, ImageSize -> 800, Frame -> All,
Spacings -> {0, -300}], {n1, 1, 3.6}, {n2, 1, 3.6},
ImageMargins -> Tiny, ControlType -> InputField, Alignment -> Top]
I don't have enough reputation to post the outcome image but you can see it here:
https://dl.dropboxusercontent.com/u/21949826/picture.png
As you can see - there is too much white space above and below the plots. How can I get rid of this?
Thanks!
It is often easier to use Grid
than GraphicsGrid
(or GraphicsRow
). Thy this:
Manipulate[
Grid[{{Plot[{rTM[\[Theta], n1, n2], rTE[\[Theta], n1, n2],
tTM[\[Theta], n1, n2], tTE[\[Theta], n1, n2]}, {\[Theta],
0, \[Pi]/2}, PlotStyle -> Thick,
PlotLegend -> {"rTM[\[Theta]]", "rTE[\[Theta]]", "tTM[\[Theta]]",
"tTE[\[Theta]]"}, LegendPosition -> {1, -0.4},
AxesLabel -> Automatic, PlotRange -> {0, 1}, ImageSize -> 400],
Plot[{RTM[\[Theta], n1, n2], RTE[\[Theta], n1, n2],
TTM[\[Theta], n1, n2], TTE[\[Theta], n1, n2]}, {\[Theta],
0, \[Pi]/2}, PlotStyle -> Thick,
PlotLegend -> {"RTM[\[Theta]]", "RTE[\[Theta]]", "TTM[\[Theta]]",
"TTE[\[Theta]]"}, LegendPosition -> {1, -0.4},
AxesLabel -> Automatic, PlotRange -> {0, 1},
ImageSize -> 400]}}], {n1, 1, 3.6}, {n2, 1, 3.6},
ControlType -> InputField, Alignment -> Top]