<html> <head> <!-- This file has been generated by unroff 1.0, 03/11/09 12:56:21. --> <!-- Do not edit! --> <STYLE TYPE="text/css"> <!-- A:link{text-decoration:none} A:visited{text-decoration:none} A:active{text-decoration:none} OL,UL,P,BODY,TD,TR,TH,FORM { font-family: arial,helvetica,sans-serif;; font-size:small; color: #333333; } H1 { font-size: x-large; font-family: arial,helvetica,sans-serif; } H2 { font-size: large; font-family: arial,helvetica,sans-serif; } H3 { font-size: medium; font-family: arial,helvetica,sans-serif; } H4 { font-size: small; font-family: arial,helvetica,sans-serif; } --> </STYLE> <title>ploticus: introduction to ploticus scripts</title> <body bgcolor=D0D0EE vlink=0000FF> <br> <br> <center> <table cellpadding=2 bgcolor=FFFFFF width=550><tr> <td> <table cellpadding=2 width=550><tr> <td><br><h2>Introduction to ploticus scripts</h2></td> <td align=right> <small> <a href="../doc/welcome.html"><img src="../doc/ploticus.gif" border=0></a><br> Version 2.41 Mar2009 </small><br><a href="../doc/scripthome.html">Scripts</a> <td></tr></table> </td></tr> <td> <br> <br> <title>Manual page for Introduction_to_ploticus_scripts(PL)</title> </head> <body> <p> Ploticus is controlled by scripts that a user creates in a text editor and saves in a file.<tt> </tt> Script files should be plain ascii text files, and they may be named anything, however a file name ending of <b>.p</b>, <b>.pl</b>, <b>.plo</b>, or <b>.pls</b> is recommended.<tt> </tt> <p> Note that for many uses you don't need to write a script at all.. you can use a <a href="prefabs.html"> ploticus prefab, </a> and control the plot by supplying some parameters on the command line while everything else is handled automatically. Scripts are useful when customization is needed, or for doing more sophisticated operations like multiple plots, overlays, data manipulation and processing, or for graph types where a prefab doesn't exist.<tt> </tt> <br><br><br> <h2>Simple example</h2> <pre> <br><img src="../gallery/simple1.gif"><br> // simple example 1 #proc areadef rectangle: 1 1 4 2 xrange: 0 5 yrange: 0 100 #proc xaxis: stubs: text Africa Americas Asia Europe,\nAustralia,\n Pacific #proc yaxis label: Growth Rate stubs: inc 20 minortics: yes minorticinc: 5 #proc getdata data: 76 54 60 59 #proc bars lenfield: 1 color: teal barwidth: 0.2 </pre> <p> As you can see, this is not low-level 3GL-style code. It is a sort of hybrid; plotting actions (#procs) are specified in procedural order, but within each #proc the language is goal-driven (4GL). Thus, traditional procedural programming skills are not required.<tt> </tt> <p> The above ploticus script invokes a number of procedures (procs).<tt> </tt> First, <b>proc areadef</b> to set up a plotting area, then <b>proc xaxis</b> and <b>yaxis</b> to render the axes.<tt> </tt> Then <b>proc getdata</b> is invoked to define some data, and then finally <b>proc bars</b> is invoked to produce a bar graph.<tt> </tt> <p> For each proc, the user may specify a various attributes or options.<tt> </tt> Attributes that are not specified use a default when possible.<tt> </tt> In the above example, the user has invoked <tt>proc areadef</tt> and specified values for these attributes: <tt>rectangle</tt>, <tt>xrange</tt>, and <tt>yrange</tt>. All of the procs, as well as the names, types, and acceptable values for all attributes, are described in the <a href="../doc/scripthome.html"> ploticus scripts handbook.<tt> </tt> </a> <br><br><br> <h2>Another example</h2> <br><img src="../gallery/simple2.gif"><br> A typical use of ploticus is to display chronological data.<tt> </tt> Suppose we have some data in a file called <tt>log.dat</tt> that has fields <tt>count</tt> and <tt>dt</tt> like this: <pre> 18 071301 16 071401 15 071501 34 071601 ...etc.. </pre> Here's a script that will automatically scale to the data and plot the values over time as shown above: <pre> // simple example 2 #proc getdata file: ../pltestsuite/data19 fieldnames: count dt #proc areadef rectangle: 1 1 5 3 xscaletype: date mmddyy xautorange: datafield=dt yautorange: datafield=count incmult=2.0 lowfix=0 xaxis.stubs: inc 1 month xaxis.stubformat: Mmmyy yaxis.stubs: inc #proc lineplot xfield: dt yfield: count linedetails: color=red </pre> <br><br> <p> A large collection of script examples may be found in the <a href="../gallery/index.html"> ploticus scripts gallery.<tt> </tt> </a> One way to proceed is to locate an example that is similar to what you want, and then copy it and play with it.<tt> </tt> <p> <br><br><br> <a href="scriptsyntax.html"> Continue to Script Syntax page </a> <p> <br> <br> </td></tr> <td align=right> <a href="../doc/welcome.html"> <img src="../doc/ploticus.gif" border=0></a><br><small>data display engine <br> <a href="../doc/Copyright.html">Copyright Steve Grubb</a> <br> <br> <center> <img src="../gallery/all.gif"> </center> </td></tr> </table> <br> <center> <table><tr><td> Ploticus is hosted at http://ploticus.sourceforge.net</td><td> </td><td> <a href="http://sourceforge.net/projects/ploticus"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=38453&type=12" width="120" height="30" border="0" alt="Get ploticus data display engine at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a> </td></tr></table> </center> <p><hr> Markup created by <em>unroff</em> 1.0, <tt> </tt> <tt> </tt>March 11, 2009. </body> </html>