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
Arrowhead Sizes
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
Circle draws a circle with the center point and radius given. Subsequent arguments specify additional radii.
Circle also has a final optional argument, "fill". This string indicates that all circles defined in the function are filled with the current fill color. If "fill" is omitted, the circle is empty.
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.
RGB Color and Color to RGB convert color values between JMP color numbers and the Red-Green-Blue system. For example, to find the RGB values for JMP color 3 (red):
Likewise, HLS Color and Color to HLS convert color values between JMP color numbers and the Hue-Lightness-Saturation system.
Finally, Heat Color returns the JMP color that corresponds to a value in any color theme that is supported by Cell Plot, Treemap, and so on. The syntax is:
The theme message is optional, and the default value is "Blue to Gray to Red". You can specify any color theme, including custom color themes. You can also create and use an anonymous color theme. For example,
Transparency and Rectangles
The Fill Pattern function has been deprecated and is now obsolete. It can be present in a script without causing errors, but has no effect.
You can also control Line Style by number (0–4) or name (Solid, Dotted, Dashed, DashDot, DashDotDot).
Line Styles
To control the thickness of lines, set a Pen Size and specify the line width in pixels. The default is 1 for single-pixel lines. For printing, think of Pen Size as a multiplier for the default line width, which varies according to your printing device.
You can also draw using pixel coordinates. First you set the Pixel Origin in terms of graph coordinates, and then use Pixel Move To or Pixel Line To commands in pixel coordinates relative to that origin. The main use for Pixel commands is for drawing custom markers that do not vary with the size or scale of the graph. You can store a marker in a script and then call it within any graph. This example uses Function to store pixel commands in a script with its own arguments, x and y.
Drawing Custom Markers