14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 12 <strong>Scripting</strong> Graphs 413<br />

Drawing Lines, Arrows, Points, and Shapes<br />

Figure 12.16 Drawing a Polygon<br />

Contours<br />

A related command, In Polygon, tells whether a given point falls inside the polygon specified. This code<br />

checks some points from the JMP man pictured in Figure 12.16.:<br />

In Polygon(0,60, GcoordX,GCoordY); //returns 0<br />

In Polygon(30,38, GcoordX,GCoordY); //returns 1<br />

Or you can add In Polygon to the JMP man script. Run this script, and then click various locations in the<br />

picture and watch the Log window.<br />

new window("The JMP man",<br />

graph box(framesize(300,300), xscale(-10,80),yscale(-10,80),<br />

pen color("black"); fill color("black");<br />

polygon(gCoordX, gCoordY);<br />

mousetrap({},print(if(in polygon(x,y,gCoordX,gCoordY),"in","out")))));<br />

Contour draws contour lines using a grid of coordinates. Its syntax is:<br />

Contour(xVector,yVector,zGridMatrix,zContour,);<br />

Given an n by m matrix zGridMatrix of values on some surface, defined across the n values of xVector<br />

by the m values of yVector, this function draws the contour lines defined by the values in zContour in<br />

the colors defined by zColors.<br />

// testContour<br />

x = (-10 :: 10) / 5;<br />

y = (-12 :: 12) / 5;<br />

grid = J( 21, 25, 0 );<br />

z = [-.75, -.5, -.25, 0, .25, .5, .75];<br />

zcolor = [3, 4, 5, 6, 7, 8, 9];

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!