simplot library

overview of available routines

Description

Simplot is a plot package, especially designed for C programmers. It also contains a simplot program for use by those having no programming experience at all. A very simple program, let's call it simple.c, looks like this:
#include <simplot.h>

int main(void) {
   plinit(X,"",200,200,15,15,"","");
   plloop();
   exit(0);
}
This program simply displays an X window of 200 x 200 millimeters, which has the origin at 15 mm from the left side and 15 mm from the bottom. It makes use of the default plevent routine, which recognises only a few interactions: the key stroke q ends your program, and the left mouse button displays cross hairs and their (x,y) position. The window also shows one button `Quit', which you can click with obvious results. Assuming that you installed Simplot in the default location, /simplot, you can compile this program with:
cc -I/usr/openwin/include \
   -I/simplot/include \
   -c -o simple.o simple.c

cc -L/simplot/lib \
   -L/usr/openwin/lib \
   -L/usr/X11R6/lib \
   -lsimplot -lxview -lolgx -lX11 -lm \
   -o simple simple.o \
You can make your own plevent routine to have more functionality. Here is an example:
#include <simplot.h>

void plevent(float x, float y, int key) {
   static float xx,yy;
   static int leftdown=FALSE;
   switch(key) {
      case 'q':
         plend();
         exit(0);
         break;
      case MouseMiddleDown:
         plmess("%g %g",x,y);
         plhairs(x,y,TRUE,TRUE);
         break;
      case MouseLeftDown:
         leftdown=TRUE;
         plmess("%g %g",x,y);
         plu(xx=x,yy=y);
         break;
      case MouseDrag:
         plmess("%g %g",x,y);
         if (leftdown) {
    	   plu(xx,yy);
	   pld(xx=x,yy=y);
         } else {
           plhairs(x,y,TRUE,TRUE);
         }
         break;
      case MouseLeftUp:
      case MouseMiddleUp:
         leftdown=FALSE;
         plhairs(x,y,FALSE,FALSE);
         plmess("");
         break;
   }
}

int main(void) {
   plinit(X,"",200,200,15,15,"","");
   plloop();
   exit(0);
}
This program shows the same cross hairs as the previous example, but in this case on pressing the middle mouse button. The left button now lets you draw free-hand curves. Here is an overview of all Simplot's routines; click on the routine names for full detail:

Overview

aplarcxcenter,ycenter,radius,start_angle,arc ,line_style \b
plot an arc using user units
plarcmxcenter,ycenter,radius,start_angle,arc ,line_style \b
plot an arc using user units
plarcrdxcenter,dycenter,arc ,line_style \b
plot an arc relative to the current position, in user units
plarcrmdxcenter,dycenter,arc ,line_style \b
plot an arc relative to the current position, in millimeter units
plarrowdx,dy,len_pointer,ang_small,ang_large ,both_ends ,open,filled,perpendicular ,*text \b
plot an annotated arrow
plaxesxleft,ybot,xright,ytop,xlen,ylen ,*xtext,*ytext,*text \b
plot x-- and y--axes, more or less automatically
plaxfit*x,*y ,n ,dpercent,xlen,ylen ,*xtext,*ytext,*text \b
plot axes, fitted to an (x,y) array
bplblockx1,y1,z1,x2,y2,z2 \b
plot a 3D-block in user units
plblockmx1,y1,z1,x2,y2,z2 \b
plot a 3D-block in millimeter units
plboxx1,y1,x2,y2,radius \b
plot a box with rounded corners in user units
plboxmx1,y1,x2,y2,radius \b
plot a box with rounded corners in millimeter units
plbutton*label ,(*func )()\b
create a button in an X-display
cplclipx1,y1,x2,y2 \b
set clipping rectangle in user units
plclipmx1,y1,x2,y2 \b
set clipping rectangle in millimeter units
plcont*xy,*x,*y ,nx,ny,nxa ,height ,*ident ,line_style ,*flag \b
plot contours in an (x,y) array
plcolorred,green,blue \b
set the current color
dpldx,y \b
draw a straight line to a position in user units
pldmx,y \b
draw a straight line to a position in millimeter units
pldotx,y \b
plot a dot with diameter equal to current linewidth in user units
pldotmx,y \b
plot a dot with diameter equal to current linewidth in millimeter units
pldraw(void)\b
the user's drawing routine; (re)draws everything
eplend(void) \b
end plotting session
pleventxpointer,yointer ,event_code \b
handle X-events
plexit*message \b
print a message to standard error and exit
pleyexeye,yeye,zeye,xfocus,yfocus,zfocus \b
define location and focus of the eye in a 3D plot in user units
pleyemxeye,yeye,zeye,xfocus,yfocus,zfocus \b
define location and focus of the eye in a 3D plot in millimeter units
fplfillfill_red,fill_green,fill_blue,stroke_red,stroke_green,stroke_blue \b
fill and/or stroke the current path
plfcolorfill_red,fill_green,fill_blue \b
set fill_color for filled objects
plfont(void)\b
toggle between primary and alternate font
plformatleft_right,up_down ,*format... \b
plot text according to extended C-format string with justification
plframedistance ,radius \b
draw a (rounded) box around current plot
plfunc(*func)(xf),xmin,ymin,xmax,ymax ,line_style \b
plot a 2D function
gplgetname \b
return the value of a global variable
hplhairsx,y ,horizontal,vertical \b
(re)display or clear horizontal and/or vertical hairs in an X-application
plhiss*x,*y ,n,type,baseline ,ybase ,line_style ,ang,dis ,icshad \b
plot shaded histogram
plhist*x,*y ,n,type,baseline ,ybase \b
plot histogram or stick plot
iplinitdrvr ,*file ,xsize,ysize ,*main_font,*alternate_font \b
initialize the plot-system
lplloop(void)\b
start event loop
mplmess*format... \b
display a formatted message
plmvorgx,y \b
move the origin in user units
plmvorgmx,y \b
move the origin in millimeter units
oplotx,y ,line_style \b
move the pen to a new 2D position in user units
plotmx,y ,line_style \b
move the pen to a new 2D position in millimeter units
plot3x,y,z ,line_style \b
move the pen to a new 3D position in user units
plotm3x,y,z ,line_style \b
move the pen to a new 3D position in millimeter units
plotrx,y ,line_style \b
move the pen to a new relative 2D position in user units
plotrmx,y ,line_style \b
move the pen to a new relative 2D position in millimeter units
plotr3x,y,z ,line_style \b
move the pen to a new relative 3D position in user units
plotrm3x,y,z ,line_style \b
move the pen to a new relative 3D position in millimeter units
pplpage(void)\b
feed a new page / clear the screen
plpgon*x,*y ,n,filltype ,spacing,angle ,line_style,last \b
plot a (filled) polygon
plpie**label ,n,lablen ,radius,x,y ,*toptext ,topfac ,*bottext ,botfac \b
plot an annotated pie
plpline*x,*y ,n ,*marker ,dash \b
plot a 2D polyline
plpline3*x,*y,*z ,n,isym \b
plot a 3D polyline
plpolarsize,angle ,pen \b
plot e vector in polar coordinates in user units
plpolarmsize,angle ,pen \b
plot e vector in polar coordinates in millimeter units
plpolc*p \b
retrieve the coefficients of the current polynomial
plpolf*x,*y ,n,kk \b
calculate a polynomial
plpolvx \b
evaluate the current polynomial in x
plpoly*x,*y ,n,kk ,xmin,xmax ,line_style \b
calculate and plot a polynomial
rplrectx1,y1,x2,y2 \b
plot a (filled) rectangle in user units
plrectmx1,y1,x2,y2 \b
plot a (filled) rectangle in millimeter units
plrectrdx,dy \b
plot a (filled) relative rectangle in user units
plrectrmdx,dy \b
plot a (filled) relative rectangle in millimeter units
pldraw(void)\b
user-defined routine redrawing the canvas in X-applications
plreservxrg,yrg,yhigh \b
move origin for concatenation of sub-plots
plrotatedx,dy \b
rotate user coordinate system
splsave(void)\b
save current graphics context
plscale3xmin,ymin,zmin,xmax,ymax,zmax,xlen,ylen,zlen \b
define 3D scaling factors
plsetname ,value \b
set global values
plshade*xvert,*yvert ,nvert ,dir,wmesh ,line_style \b
hatch polygon
plsize*s \b
return the length of a string plotted in the current font
plsmooth*a ,n,k \b
perform k-point smoothing on (x,y) array
plsort*x,*y ,n \b
sort (x,y) array
plsymbolisym \b
plot a symbol
tpltext0*text \b
plot a string, returning to position
pltext*s \b
plot a string, leave pen at end
pltrace(*f)(x,y),xmin,ymin,xmax,ymax,resol,grid ,*ident ,line_style \b
track an (implicit) 2D function
uplu[m]x,y \b
move to position without plotting in user units
plu[m]x,y \b
move to position without plotting in user units
plunclip(void)\b
remove clipping
plunsave(void)\b
restore graphics context
xplxbarv \b
plot error bar in x-direction
yplybarv \b
plot error bar in x-direction

Predefined names are:

A0A1A2A3
A4A5A6A7
ANGLEArrowDownArrowLeftArrowRight
ArrowUpCROSSDASHDASHUNIT
DOWNDeleteEVENT_ASCIIEVENT_BUTTON
EVENT_DOWNEVENT_FUNCTIONEVENT_UPEnd
EscapeF1F10F11
F12F2F3F4
F5F6F7F8
F9GXcopyGXxorHEIGHT
HomeInsertLEVENTSMouseDrag
MouseLeftDownMouseLeftUpMouseMiddleDownMouseMiddleUp
MouseRightDownMouseRightUpOPAQUETEXTPDF
PDFLPENDIAPLOTMODEPLOTTER
PRECISIONPSPSL
PageDownPageUpRECTFILLRECTSTROKE
RESOLUTIONUPXXANGLE
XCROSSXGRIDXINXLOG
XMARKXPENXSIZEXSKIP
XSQUARXU2MXU2PYANGLE
YCROSSYGRIDYINYLOG
YMARKYPENYSIZEYSKIP
YSQUARYU2MYU2P