Ploticus Scripts can be created in a text editor and saved in a file.
Your script will have sections for getting the data, setting up a plotting area with axes,
and rendering the plots that you want to do.
You then invoke the pl(1) command to read and process your script.
For example, pl -gif myscript -o gif > out.gif
Simple example
#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
The above ploticus script invokes a number of procedures (procs).
First, proc areadef to set up a plotting area, then
proc xaxis and yaxis to render the axes.
Then proc getdata is invoked to get or specify some data,
and then finally proc bars is invoked to produce a bar graph.
For each proc, the user may specify a various attributes or options.
Attributes that are not specified use a default when possible.
In the above example, the user has invoked proc areadef
and specified values for these attributes: rectangle, xrange,
and yrange.
All of the procs, as well as the names, types, and acceptable
values for all attributes, are described in the ploticus scripts handbook.
Another example
A typical use of ploticus is to display chronological data.
Suppose we have some data in a file called "log.dat" that has
fields "count" and "dt" like this:
18 071301
16 071401
15 071501
34 071601
...etc..
Here's a script that will automatically scale to the data and plot the values
over time as shown above:
#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
A large collection of script examples may be found in the ploticus script examples gallery.
One way to proceed is to locate an example that is similar to what you
want, and then copy it and play with it.
Continue to Script Syntax page
|