| This
is a short (and very terse) introduction to some of the more basic aspects
of Super Mongo (SM). I am by no means a "power user," but I do use SM a lot.
So here are some of the more important issues I've encountered while using SM.
Folks who are really interested in this program are strongly urged to visit the
SM official web site for
detailed instructions on how to obtain and use this plotting package.
|
At the command line, type
sm to invoke Super Mongo (SM). To open a
plotting screen, you will need to set the output device to X11 with
dev X11. If this works, you can try typing
box to see an
axis and labels.
I prefer to run SM from macros instead of the command line. Here are a few
basic plotting macros to get you started. Put them into a file (called
macros.m in this example), and invoke SM with
sm -m macros.m.
This will run the first macro in the file (which should have the same name as
the file itself). That macro is set up to call other sub-macros, the behavior
of which should be a small introduction to SM. You will also need the data
file called
data.dat in the same directory in order
for things to run properly.
macros
dev X11 # sets the output device to an Xwindow
setupbox # run the setupbox macro
readindata data.dat # run the readindata macro
epsplot pt.eps data.dat # make a hard copy of the plot
setupbox
limits -2.5 2.5 -5 5 # set the plot axis limits
box # draw in and label the axis box
return # done with this macro
readindata 1
data $1 # use first argument as the data file
read x 1 # read first column into the X vector
read y 2 # read second column into the Y vector
ptype 4 3 # used filled four-sided polygons for markers
expand 2 # make stuff twice as big
points x y # plot the data in Y vs the data in X
expand 1 # go back to normal size
ctype "blue" # change the color to blue
connect x y # connect points with a line
ctype "default" # change the color back to the default
expand 1.2
xlabel "The X axis" # set x axis label
ylabel "The Y axis" # set y axis label
toplabel "Plot Title" # make a title for the plot
expand 1
return # done with this macro
epsplot 2
dev postencap $1 # redirect output to an .eps file
setupbox # run the setup box macro
readindata $2 # run the readindata macro with given data file
dev X11 # return output to the Xwindow
multiplots
define x_gutter 0.5 # make space between graphs half as large as default
define y_gutter 0.5 # make space between graphs half as large as default
window 2 2 1 2 # go to upper left of four windows
dosomething
window 2 2 2 2 # go to upper right of four windows
dosomething
window 2 2 1 1 # go to lower left of four windows
dosomething
window 2 2 2 1 # go to lower right of four windows
dosomething
|
You can also do loops in SM. The flavor I usually use is the "do" loop.
The following example shows how to implement a "do" loop in a macro. In
this case, we are trying to read in 11 different data files with names like
0.dat,
1.dat, etc, and overlay their plots. Note the
syntax for defining the
fname variable. Also, just for kicks,
we've connected the points with a histogram instead off just a straight
line. The histogram function isn't doing any binning. Instead, it is
assuming that the data values already represent the bin heights, and just
figuring out how the histogram should look.
loopex
dev x11 # set the display
limits -1 1 0 320 # set limits on plot
box # draw axis and labels
do i=0,10{ # do the following 10 times:
define fname $i".dat" # files are 1.dat, 2.dat...
echo $fname # check the file name
data $fname # open the file
read x 1 # read in x values
read y 2 # read in y values
points x y # plot them
histogram x y # overlay a histogram
} # finish the loop
return
|
Note: to get SM to understand TeX strings, put the following line in your
.sm file:
TeX_strings 1 # understand TeX strings