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 419<br />

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

Figure 12.20 Line Styles<br />

To control the thickness of lines, set a Pen Size and specify the line width in pixels. The default is 1 for<br />

single-pixel lines. For printing, think of Pen Size as a multiplier for the default line width, which varies<br />

according to your printing device.<br />

pen size(2); //double-width lines<br />

Drawing With Pixels<br />

You can also draw using pixel coordinates. First you set the Pixel Origin in terms of graph coordinates,<br />

and then use Pixel Move To or Pixel Line To commands in pixel coordinates relative to that origin.<br />

The main use for Pixel commands is for drawing custom markers that do not vary with the size or scale of<br />

the graph. You can store a marker in a script and then call it within any graph. This example uses Function<br />

to store pixel commands in a script with its own parameters, x and y.<br />

ballotBox = Function( {x, y},<br />

Pixel Origin( x, y );<br />

Pixel Move To( -5, -5 );<br />

Pixel Line To( -5, 5 );<br />

Pixel Line To( 5, -5 );<br />

Pixel Line To( -5, -5 );<br />

Pixel Line To( 5, 5 );<br />

Pixel Line To( -5, 5 );<br />

Pixel Move To( 5, 5 );<br />

Pixel Line To( 5, -5 );<br />

);<br />

New Window( "Custom markers",<br />

Graph Box(<br />

framesize( 200, 200 ),<br />

ballotBox( 10, 10 );<br />

ballotBox( 15, 90 );<br />

ballotBox( 20, 50 );<br />

ballotBox( 80, 50 );<br />

ballotBox( 60, 70 );<br />

)

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

Saved successfully!

Ooh no, something went wrong!