Wolfram Library Archive


All Collections Articles Books Conference Proceedings
Courseware Demos MathSource Technical Notes
Title Downloads

Updating webplot which shows baseline
Author

Raja Kountanya
Revision date

2014-04-01
Description

I was looking for a way to show a "web" plot, that is, a plot which shows the change of 5 variables with changes in 3 variables. I also wanted to show the baseline and the updated plot in one place in an interactive Manipulate.

Of course, I would need to turn ContinuousAction->False so that the baseline does not update on the fly. The trick was to use a dummy control as a local variable. I have reproduced the code below.

plt = Graphics[{Line[{{0, 0}, {Cos[#2], Sin[#2]}}], Text[Style[#1, 16], 1.05 {Cos[#2], Sin[#2]}]} & @@@ ({{"\[Eta]", "\[Phi]n", "\[Phi]i", "\[Theta]i", "\[Theta]n"}, Range[0, 9 \[Pi]/5, 2 \[Pi]/5]}\[Transpose])]; Manipulate[Module[{pl}, pl[1] = Last@WebPlot[os, Blue]; pl[2] = Last@WebPlot[f[\[Alpha]n, i, \[Beta]a]]; os = First@WebPlot[f[\[Alpha]n, i, \[Beta]a]]; Show[plt, pl[1], pl[2]] ], {{i, 10, "i"}, -60, +60, ContinuousAction -> False}, {{\[Alpha]n, 10, "\[Alpha]n"}, -30, +30, ContinuousAction -> False}, {{\[Beta]a, 10, "\[Beta]a"}, 0, +65, ContinuousAction -> False}, {{os, f[10, 10, 10]}, ControlType -> None}, Initialization :> ( f[\[Alpha]n_, i_, \[Beta]a_] := {2 \[Alpha]n, i + \[Alpha]n, \[Beta]a, \[Beta]a + i, \[Alpha]n + \[Beta]a + i}; WebPlot[{\[Eta]_, \[Phi]n_, \[Phi]i_, \[Theta]i_, \[Theta]n_}, col_: Red] := Module[{pts}, pts = {1/ 40 Abs[{\[Eta], \[Phi]n, \[Phi]i, \[Theta]i, \[Theta]n}], Range[0, 9 \[Pi]/5, 2 \[Pi]/5]}\[Transpose]; {{\[Eta], \[Phi]n, \[Phi]i, \[Theta]i, \[Theta]n}, Graphics[{col, Thickness[0.01], Line[#1 {Cos[#2], Sin[#2]} & @@@ AppendTo[pts, pts[[1]]]]}]} ]), TrackedSymbols :> {i, \[Alpha]n, \[Beta]a} ]
Subjects

*Wolfram Technology > Programming > 2D Graphics
*Wolfram Technology > Programming > Animations
*Wolfram Technology > Programming > Graphing and Plotting
Keywords

interactive, web plot, baseline, comparison, multiple input, multiple output
Downloads Download Wolfram CDF Player

Download
Webplotwithupdating.nb (25 KB) - Mathematica Notebook