You can use the following commands inside Graph Box statements. This chapter focuses on the JSL that is specific to graphing, but you can also use general script commands like For, While, and so on.
A YFunction operator is used to draw smooth functions. The first argument is the expression to be plotted, and the second argument is the name of the X variable in the expression.
Sine Wave
You can use For to overlap several sine waves:
Overlapping Sine Waves
Similarly, an XFunction is for drawing a plot where the symbol is varied on the Y variable.
Overlapping Sine Waves Along the X-Axis
An XYFunction draws a smooth curve using a pair of formulas (parametric equations) that depend on a third variable. The third variable’s value is incremented from a minimum value to a maximum value to generate the X-Y pairs.
Spiral Parametric Plot
ContourFunction is an analogous way to represent a three-dimensional function in a two-dimensional space. The final argument specifies the value(s) for the contour line(s), and it can be a value, an indexed range of values using ::, or a matrix of values.
Egg Carton Function
Normal Contour draws normal probability contours for k populations and two variables. The first argument is a scalar probability or a matrix of probability values for the contours, and subsequent arguments are matrices to specify means, standard deviations, and correlations. The mean and standard deviation matrices have dimension k × 2. The correlation matrix should be k × 1, where the first row pertains to the first contour, the second row to the second contour, and so on. The first column is for x and the second column for y. For example:
The following script draws contours at probabilities 0.1, 0.5, 0.7, and 0.99 for two populations and two variables. The first population has x mean 0 and y mean 1, with standard deviation 0.3 along the x axis and 0.6 along the y-axis, and with correlation 0.5. The second has x mean 4 and y mean 6, with standard deviation 0.8 along the x axis and 0.4 along the y-axis, and with correlation 0.9.
Normal Contour Function
Normal Contour is thus a generalized way to accomplish effects like Bivariate’s density ellipses, which are demonstrated to good effect with the Football sample data (just open the data table Football and run its stored Bivariate script).
Gradient Function(expression, xname, yname, [zlow, zhigh], ZColor([colorLow, colorHigh]), <XGrid(min, max, incr)>, <YGrid(min, max, incr)>)
GradientFunction(
The ZColor values must be numeric codes, rather than names. You can use the color menu indices (0=black, 1=grey, 2=white, 3=red, 4=green, 5=blue, and so on) found in Colors.
The following example script uses the Gradient function, with the picture showing two frames of the animation.
Gradient Function
Returns the x-value for the left edge of the graphics frame.
Returns the y-value for the bottom edge of the graphics frame.
You can add a legend to a graph, using the Row Legend command. The following example uses the Fitness.jmp sample data file, and sets colors and markers based on the Age column, and adds a legend to the plot.
The marker()argument has binary arguments. If you specify 1, the markers are set to each point.
Color(0) turns the color legend on.
Color(1) turns the color legend off.