Handle() places a marker at the coordinates given by the initial values of the first two arguments and draws the graph using the initial values of the arguments. You can then click and drag the marker to move the handle to a new location. The first script is executed at each mousedown to update the graph dynamically, according to the new coordinates of the handle. The second script (optional, and not used here) is executed at each mouseup, similarly; see the example for Mousetrap().
mu = 0;
sigma = 1;
Run demoPlotProb.jsl in the JMP Samples/Scripts folder to see Beta Density, Gamma Density, Weibull Density, and LogNormal Density graphs. The output for Normal Density is shown in 图 12.23. Because we cannot show you the picture in motion, be sure to run this script yourself.
If you want to use some function of a handle’s coordinates, such as in the normal density example, you should adjust the arguments for Handle(). Otherwise, the handle marker would run away from the mouse.
Suppose you drag the marker from its initial location to (3,4). The argument a is set to 6 and b to 4; the graph is redrawn as Y = 6x4; and the handle is now drawn at (6,4), several units away from the mouse. To compensate, you would adjust the first argument to handle, for example.
To generalize, suppose you define the Handle() arguments as functions of the handle’s (x, y) coordinates. For example, a=f(x) and b=g(y). If f(x)=x and g(y)=y, then you would specify simply a,b as the first two arguments. If not, you would solve a = f(x) for x and solve b = g(y) for y to get the appropriate arguments.
You can use other functions to constrain Handle(). For example, here is an interactive graph to demonstrate power functions that uses Round() to prevent bad exponents and to keep the intercepts simple.
a = 3;
b = 2;
Handle() and For() can be nested for complex graphs.
a = 5;
b = 5;
图 12.25 Nested Handle() and For()
amplitude = 1;
freq = 1;
phase = 0;
图 12.26 Two Handles