Line draws lines between points.
Using Lines to Draw a Star
You can either specify the points in two-item lists as demonstrated above or as matrices of x and then y coordinates. Matrices are flattened by rows, so you can use either row or column vectors, as long as you have the same number of elements in each matrix. The following would be equivalent:
Thus, the star example could also be drawn this way. Note that it must use full Matrix({...}) notation rather than [ ] shorthand since the entries are expressions.
HLine draws a horizontal line across the graph at the y-value you specify. Similarly VLine draws a vertical line down the graph at the x-value you specify. Both commands support drawing multiple lines by using a matrix of values in the y argument. These are illustrated in the example under MouseTrap.
Similarly, Arrow draws an arrow from the first point to the second. The default arrowhead is scaled to 1 plus the square root of the length of the arrow. To set the length of the arrowhead, add an (optional) first argument, specifying the length of the arrowhead, in pixels.
Drawing Arrows
As with Line, you can either specify the points in two-item lists as demonstrated above or as matrices of x and then y coordinates.
Marker draws a marker of the type that you specify (1–15) in the first argument at the point that you specify in the second argument. Marker Size scales markers from 0–6 (dot–XXXL). To set markers to the preferred size, use a value of -1.
Drawing Markers
You can also include a row state argument before, after, or instead of the marker ID argument. By using Combine States, you can set multiple row states inside Marker. Try substituting each of these lines in the graph script above:
Pie and Arc draw wedges and arc segments. The first four arguments are x1, y1, x2, and y2, the coordinates of the rectangle to inscribe. The last two arguments are the starting and ending angle in degrees, where 0 degrees is 12 o'clock and the arc or slice is drawn clockwise from start to finish.
Drawing Pies and Arcs
Drawing Circles
Rect draws a rectangle from the diagonal coordinates you specify. The coordinates can be specified either as four arguments in order (left, top, right, bottom), or as a pair of lists ({left, top}, {right, bottom}).
Rect has an optional fifth argument, fill. Specify a zero to get an unfilled rectangle, and a one to get a filled rectangle. The rectangle is filled with the current fill color. The default value for fill is 0.
Oval draws an oval inside the rectangle given by its x1, y1, x2, and y2 arguments:
Oval also uses the optional fifth argument, fill. Specify a zero to get an unfilled rectangle, and a one to get a filled oval. The oval is filled with the current fill color. The default value for fill is 0.
Rectangles and Ovals, Unfilled and Filled shows rectangles and ovals, drawn both filled and unfilled. Notice that filled rectangles do not have outlines, while ovals do. If you want a filled rectangle with an outline, you must draw the filled rectangle, and then draw an unfilled rectangle with the same coordinates.
Rectangles and Ovals, Unfilled and Filled
Polygon works similarly to Line, connecting points but also returning to the first point to close the polygon and filling the resulting area. You can specify the points as individual points in two-item lists (as shown for Marker, above) or as matrices of x and then y coordinates. Matrices are flattened by rows, so you can use either row or column vectors, as long as you have the same number of elements in each matrix. First set up the matrices of points, then call them inside Polygon().
Drawing a Polygon
A related command, In Polygon, tells whether a given point falls inside the polygon specified. This code checks some points from the JMP man pictured in Drawing a Polygon.:
Or you can add In Polygon to the JMP man script. Run this script, and then click various locations in the picture and watch the Log window.
Contour draws contour lines using a grid of coordinates. Its syntax is:
Contour(xVector,yVector,zGridMatrix,zContour,<zColors>);
Given an n by m matrix zGridMatrix of values on some surface, defined across the n values of xVector by the m values of yVector, this function draws the contour lines defined by the values in zContour in the colors defined by zColors.
Drawing Contour Lines
You can use Text to draw text at a given location. The point and text can be in any order and repeated. You can precede the point and text with an optional first argument, Center Justified, Right Justified, Erased, Boxed, Counterclockwise, or Clockwise. Erased is for “erasing” whatever would otherwise obscure the text in a graph. It paints a background-colored rectangle behind the text. In the example below, notice how the erased text appears inside a white box over the green Rect. The other effects are self-explanatory.
Drawing Text in a Graph Box
Five commands control colors. Fill Color sets the color for solid areas, Pen Color for lines and points, Back Color for the background of text (similar to the box around the erased text above), Background Color for the graph’s background color, and Font Color for added text.
 Number Name Demonstration script to try 0 Black colors={"Black", "Gray", "White", "Red", "Green", "Blue", "Orange", "BlueGreen", "Purple", "Yellow", "Cyan", "Magenta", "YellowGreen", "BlueCyan", "Fuchsia"}; ymax=15; mygraph=New Window("The JMP colors", Graph Box(FrameSize(300,300), XScale(0, ymax), yScale(0, ymax+2), for(i=0, i