This page provides simple examples to illustrate how SpOd may be used.
 
SpOd provides an elementary set of features. The visualisation effects that are possible using the available set of options is largely open to the imagination of the user. By providing some examples here we may stimulate you to think about how to best present information that is visually appealing and effective in communication to others the patterns and structures in your data.
 
We begin with simple graph drawing examples. Most of these use simple UNIX shell scripts to generate the data on the fly. If you want to understand the data format then simply save the data to a file or display it on the screen instead of piping to SpOd.
 
Now these UNIX scripts are sensitive to syntax. The scripts that appear here ought to be able to be copied and pasted to your terminal window but be aware that some browsers interfere with the simple act of copying or pasting even text data. You have been warned...
 
By providing you with the script you have the opportunity to dissect the code to see exactly what is being created
 
Example 1.1:  A simple graph
echo "y:g:mygraph 1000 1 9 4 0 0 0 0" | awk '{
printf "%s\n", $0;
split($0,an," ");
for (i=1; i <=an[2]; i++) { printf "%f ",rand();}
}' | spod
 
This script generates a 1000 random values in the range of [0,1] and graphs them as a static graph in the y-x plane, which is the default viewing plane.
 
The left mouse button can be used to rotate the viewing angle.
 
If you leave out the “| spod “ the script will display on the terminal the text that is being used to create the graphical object.
 
y:g:mygraph 1000 1 9 4 0 0 0 0
0.000008 0.131538 0.755605 0.458650 0.532767 ...
 
 
For an explanation of the format have a look at  the papers:
 
Example 1.2: now lets offset the graph wrt the x-axis, activate the display reference grid.
Note that the graph is also displaced in the z direction slightly to bring the graph in front of the grid using the z-offset 0.1. You may rotate the image to see this side on.
 
echo "G 0.7 0.0 0.5 9.0 5.0 0.0 0.0 0.0 0.0 1.0 1.0 0.0
y:g:mygraph 1000 1 9 4 0 0 -2 .1" | awk '{cnt++;
printf "%s\n", $0;
if (cnt ==2) {
split($0,an," ");
for (i=1; i <=an[2]; i++) { printf "%f ",rand();}
}
}' | spod
 
 
        
 The grid brightness may be controlled as on an oscilloscope through a combination of ways. The “G” settings which determine the initial “load” state are explained elsewhere in the documentation. Interactively, the shift-1 and shift-2 keys increase and decrease the brightness respectively, and also in conjunction with the shift-mouse-left button. (The grid in the z-x plane is similarly controlled by shift-3 (brighten ) and shift-4 (darken) keys. and shift-5 toggles the major axes on/off.)
 
Example 1.3: ten times the data !
 
echo "G 0.7 0.0 0.5 9.0 5.0 0.0 0.0 0.0 0.0 1.0 1.0 0.0
y:g:mygraph 10000 1 9 4 0 0 -2 .2" | awk '{cnt++;
printf "%s\n", $0;
if (cnt==2) {
    split($0,an," ");
    for (i=1; i <=an[2]; i++) { printf "%f ",rand();}
}
}' | spod
 
Its clear that not all the points can be displayed at a time without the display looking distinctly crowded.  We have several options. One is to display the points only, by adding the graphics qualitfyier
“p:.:points”. p indicates that it is a ploting qualifier, the period indicates plot mode with points, and this is followed by a mandatory text label string. The colon characters are delimiting characters in the qualifier.
 
 
echo "G 0.7 0.0 0.5  9.0 5.0 5.0  0.0 0.0 0.0  1.0 1.0 0.0
y:g:mygraph 10000 1 9 4 0 0 -2 .2" | awk '{cnt++;
printf "%s\n", $0;
if (cnt==2) {
    split($0,an," ");
    for (i=1; i <=an[2]; i++) { printf "%f ",rand();}
    printf "\np:.:points\n";
}
}' | spod
 
 
An alternative is to display a window onto the data, to create what is in effect a dynamic trace or polygraph style display. This is achieved by capitalising the Y in the “Y:g:mygraph” object specifier.  Use the right-mouse button to scroll the display horizontally. The left-mouse button will rotate the graph view.
echo "G 0.7 0.0 0.5  9.0 5.0 5.0  0.0 0.0 0.0  1.0 1.0 0.0
Y:g:mygraph 100000 1 9 4 0 0 -2 .2" | awk '{cnt++;
printf "%s\n", $0;
if (cnt==2) {
    split($0,an," ");
    for (i=1; i <=an[2]; i++) { printf "%f ",rand();}
}
}' | spod
 
It is perfectly feasible to have upwards of 10,000,000 data points  in a graph using this format and to be able to scroll through all the data in a jiffy.
 
One may also animate the display. Try typing the ‘g’ key, (even repeatedly). ‘G’ will reverse the animation effect. Try typing ‘h’, or even ‘H’.
 
Example 1.4:  Multiple graphs and traces
In many cases it is often useful to be able to display multiple graphs simultaneously. One may even wish to include static graphs with animated traces and then link positions with coloured ball-markers. Try the following example:
 
echo "G 0.7 0.0 0.5  9.0 5.0 5.0  0.0 0.0 0.0  0 0 10
C 1 1 0 1 1 1 1
I -1.0 0.000004 0.017500 0.0 -1.0
L 12 61 148 210 176 340
M 0 0 1 10
" | awk '{cnt++; print $0
if (cnt==5) {
   numbpoints=1000
   printf "\ny:g:graph1 %d 1 9 1 0 0 2 .2\n", numbpoints;
   for (i=1; i <=numbpoints; i++) { printf "%f ",sin(i*2*3.1415926/100)}
   printf "\nv:n:visible_on";
   printf "\nb:r:redball";
 
   printf "\nY:r:trace2 %d 1 9 1 0 0 -2 .2\n", 250*numbpoints;
   for (i=1; i <=250*numbpoints; i++) { printf "%f ",cos(i*2*3.1415926/100)}
   printf "\nv:n:visible_on";
   printf "\nb:g:redball";
 
}
}' | spod
  
 
The ‘l’ (lowercase ‘ell’) key will toggle the display of the graph labels and the index counters. The index counters run in the range of [0,1] and indicate the data positions with respect to the object arrays for the left-edge, centre-point, right-edge of the window respectively. When there are a few graphs only the number keys ‘1’, ‘2’, ‘3’, etc may be used to toggle the graph for display. The position of the label corresponds to the number key of the graph by the same label.
 
The ball markers are invoked by object qualifiers of the form for example ‘b:r:redball’. The third field is a mandatory label, but can be any sort of string label desired.
 
You may wish to experiment with the above script to work out which line gives rise to which display feature or features. If one wishes to capture a particular view, or set of display modes, then the environment settings may be output to the terminal window using the shift-O (output) key.
 
In principle the environment variables may be included with a set of graphics objects to preset a given view. This is discussed in more detail later.
 
 
 
 
SpOd examples 1:- graphs & traces