# Plot multiple datasets with ListPlot and SlideRegulators

I recently got into Mathematica and have a script from my professor, which calculates and plots some values zR*Tan[phi] + z0 + R1 from different variables. The variables can be adjusted by a slide. I now added another variable R2 and want to plot the values in the same plot, so I can compare values for R1 and R2.

Here is my code:

Manipulate[
Column[{
Row[Text[Style[#, FontFamily -> "Helvetica",18]] & /@ {"Anzahl der Messpunkte: ",
Length[Table[{phi/Pi*180, zR*Tan[phi] + z0}, {phi, -90 Degree,90 Degree, Schrittweite Degree}]]}],
ListPlot[Table[{phi/Pi*180, zR*Tan[phi] + z0 + R1}, {phi, -85 Degree,85 Degree, Schrittweite Degree}],
PlotStyle -> PointSize[Medium],
LabelStyle -> Directive[FontFamily -> "Helvetica", 18],
AxesLabel -> {"\[Phi][\[Degree]]", "z[mm]"},
Ticks -> {Table[phi, {phi, -90, 90, 10}], Automatic},
ImageSize -> 1000],
Prepend[N[Table[{phi/Pi*180, zR*Tan[phi] + z0 +R1, zR*Tan[phi] + z0 + R2}, {phi, -85 Degree, 85 Degree, Schrittweite Degree}]], {"\[Phi][\[Degree]]", "z[mm]",
"z[mm]"}] // MatrixForm}], {{zR, 20, "Rayleigh-Länge [mm]"}, 1, 100,1}, {{z0, 125, "Position Strahltaille [mm]"}, 0, 250,1}, {{Schrittweite, 2, "Schrittweite [\[Degree]]"}, .5,5, .5}, {{R1, 200, "Radius_1 [mm]"}, 100, 1000,50}, {{R2, 500, "Radius_2 [mm]"}, 100, 1000, 50}]


I think you want to use Show with PlotRange->All

Manipulate[
Column[{Row[
Text[Style[#, FontFamily -> "Helvetica",
18]] & /@ {"Anzahl der Messpunkte: ",
Length[Table[{phi/Pi*180, zR*Tan[phi] + z0}, {phi, -90 Degree,
90 Degree, Schrittweite Degree}]]}],

Show[{
ListPlot[
Table[{phi/Pi*180, zR*Tan[phi] + z0 + R1}, {phi, -85 Degree,
85 Degree, Schrittweite Degree}],
PlotStyle -> PointSize[Medium],
LabelStyle -> Directive[FontFamily -> "Helvetica", 18],
AxesLabel -> {"\[Phi][\[Degree]]", "z[mm]"},
Ticks -> {Table[phi, {phi, -90, 90, 10}], Automatic},
ImageSize -> 600]
,
ListPlot[
Table[{phi/Pi*180, zR*Tan[phi] + z0 + R2}, {phi, -85 Degree,
85 Degree, Schrittweite Degree}],
PlotStyle -> PointSize[Medium],
LabelStyle -> Directive[FontFamily -> "Helvetica", 18],
AxesLabel -> {"\[Phi][\[Degree]]", "z[mm]"},
Ticks -> {Table[phi, {phi, -90, 90, 10}], Automatic},
ImageSize -> 600]
}, PlotRange -> All]
,

Prepend[
N[Table[{phi/Pi*180, zR*Tan[phi] + z0 + R1,
zR*Tan[phi] + z0 + R2}, {phi, -85 Degree, 85 Degree,
Schrittweite Degree}]], {"\[Phi][\[Degree]]", "z[mm]",
"z[mm]"}] // MatrixForm}],

{{zR, 20, "Rayleigh-Länge [mm]"}, 1, 100,
1}, {{z0, 125, "Position Strahltaille [mm]"}, 0, 250,
1}, {{Schrittweite, 2, "Schrittweite [\[Degree]]"}, .5,
5, .5}, {{R1, 200, "Radius_1 [mm]"}, 100, 1000,
50}, {{R2, 500, "Radius_2 [mm]"}, 100, 1000, 50}]


I would implore you to read through the docs and take the time to understand what I've done in the above, since if I understand the query correctly I've gone out of my way to do all the work for you.

If I misunderstood something please let me know.

• thank you. It works fine! Yes, I'm right into it and trying to undertand it. – Simon Jan 18 '18 at 15:03