Splot Basics - Getting Started

When splot is started the user is presented with two windows. The left window is the drawing area where the image will be drawn. On the right is a text window were the C program specifying the drawing can be displayed. The text is edited using the built in 'e' editor and the drawing is generated by `executing' the file, i.e. by hitting CTRL G or selecting the menu item `exec' at the top. Splot can be used for drawing, graphing data or both, and since it is basically C programming, has essentially all the C programming capabilities. To introduce you to the program and demonstrate the basic concept, three simple examples are given below. To begin, an example of a simple splot program to read in and plot a data file using splot default parameters is given. The resultant drawing is shown next to it.

/* demo of simplest possible data */
/* plotting using all the defaults */

#include <splot.h>
double *data;
main()
   {
   readdata("demo\data1.dat",data);
   plotdata(data);
   label(LOWER,"Position");
   label(LEFT,"Wavelength in !m!m");
   text(6.20,22.98,"Mepsicron Calibration");
   }








Here is a simple example of a drawing using some of the built-in functions and the corresponding drawing.



/* file basic.spt */
/* Demo of a simple drawing using */
/* some built-in functions */

#include <splot.h>
main()
   {
   /* draw two boxes */
   box(6.0,20.0,11.0,16.0);
   box(6.5,19.5,8.5,18.0);
   stroke();
   /* draw two circles */
   /* input coordinates with mouse */
   arc(5.95,10.91,2.0,0,360);
   stroke();
   arc(8.96,10.73,1.0,0,360);
   stroke();
   /* draw a triangle */
   moveto(7.0,5.0);
   lineto(9.0,7.0);
   lineto(11.0,5.0);
   lineto(7.0,5.0);
   stroke();
   /* add some text */
   text(4.45,23.22,"Basic Drawing using defaults");
   }




Lastly, here is an example using some C programming capabilities such as loops.

/* This demo file shows the available symbols */
/* which can be used for data points. Symbols names */
/* equating to the numerical constants are defined */
/* in splot.h */

#include "splot.h"
main()
   {
   int i;
   /* make the symbols large. Since they are just a special font */
   /* make the font width large. */
   set(FONTWIDTH,4);
   /* change the symbol orientation just for fun */
   set(FONTDIR,30);
   moveto(1,1);
   /* show all 17 symbols in a diagonal line */
   for (i = 0;i < 17;i++)
      {
      /* use a relative move here */
      rmoveto(1,1);
      symbol(i);
      }
   /* try other form of symbol */
   set(SYMMULT,2);
   symbol(4,12,OSTAR);
   set(SYMMULT,0.5);
   /* add some extra arrows to illustrate the */
   /* arrowto() function */
   moveto(3.82,17.19);
   arrowto(7.96,15.68);
   arrowto(10.21,19.72);
   rarrowto(3,0);
   stroke();
   }








There are two ways a drawing can be made.
1 . by typing in a C program text file using the built-in editor.
2 . by using the mouse and pull-down menus to insert commands into the text file (see section [*]).
Depending on which is more convenient for the task at hand, one can either draw interactively with the mouse or enter text. The drawing is only generated upon execution of the text file.

The text editor that is built into Splot is a fully featured editor with some very powerful capabilities. Ordinary operation should, however, be very intuitive. For a description of the text editor component of Splot refer to Chapter [*]. Only a brief introduction to give you the basics to get going is presented here. The text cursor represented by an underscore in the text window can be moved using the arrow key pad or the mouse. Clicking the left mouse button positions the text cursor at the mouse cursor location. Scrolling is accomplished with the page up/down keys or by clicking on the scroll fields along the right side of the text window. A file is written to disk with the name specified on the highlighted status line at the bottom of the text window with a CTRL W (write) command (or use the save menu item). To remove a file use the CTRL Q (quit) command (or use the quit menu item). Splot itself terminates when the last file is removed. To add a new file to the ring of files to be edited or executed type '<esc> e file.nam' where file.nam is the name of the desired file or select the open menu item.



Subsections