Tips for Using xmgr
xmgr is a menu-driven program for 2D plotting that produces publication
quality output. It also has a command language for designing templates
for complex figures.
In addition to plotting, xmgr can do some data analysis, such as regressions,
splines, fft's, and applying functions to data.
It is invoked by typing "xmgr" on any of
our workstations (RS/6000, SGI, Linux). It is recommended that the
following line be included in your .Xdefaults file:
XMgr*fontList: -adobe-helvetica-bold-r-normal--14-*-*-*-*-*-iso8859-1
Otherwise, the menus will appear in a small, indistinct font.
Some Simple Examples to Get Started:
-
If file.* are m-by-2 matrices, "xmgr file.*" will plot all
the curves on a single plot. (m can be different for each file)
-
If file is an m-by-k matrix, "xmgr -nxy file" will plot k-1 curves against
column 1 in a single plot. Each curve will be a different color.
-
If file1 and file2 are m-by-2 matrices
"xmgr -graph 0 file1 -graph 1 file2 -rows 2"
will stack the two plots vertically.
"xmgr -graph 0 file1 -graph 1 file2 -cols 2"
will stack them horizontally.
To put 4 plots on a page in a 2x2 array do:
"xmgr -graph 0 file1 -graph 1 file2 -graph 2 file3 -graph 3 file 4 -arrange 2 2"
-
To plot multiple curves xplot style, terminate each curve with an "&":
x1 y1
x2 y2
x3 y3
&
w1 v1
w2 v2
&
-
To pick and choose columns from a matrix-type file:
x y1 y2 y3 y4 ...
x y1 y2 y3 y4 ...
Plot col 2 vs. 1 and col 4 vs. 1 in one graph:
xmgr -block file -bxy 1:2 -bxy 1:4
In two stacked graphs:
xmgr -rows 2 -block file -graph 0 -bxy 1:2 -graph 1 -bxy 1:4
(graph 0 is on the bottom with cols 1,2; graph 1 above with cols 1,4).
Semi-Interactive Method:
xmgr -rows 2
Use File/Read Block Data to pump data into selected graph.
You can have up to 10 graphs, each of which can have up to 30 data sets
contained in one file divided up arbitrarily among several files,
provided the right flags are given. The total number of points plotted can
be in the hundreds of thousands. (The limits 10 and 30 can be increased with
the maxsets, maxgraph, and graphsets options described below.)
Additional Sources of Information
There is an 80 page manual in the computer room which has a brief tutorial
on pp. 12-20. There is a brief man entry that can be accessed by typing
man xmgr, provided MANPATH is set to "/usr/local/man:/usr/man".
There is a detailed Web-based manual at:
http://mrb.niddk.nih.gov/xmgr/index.html.
The Web manual is also accessible from within xmgr if you do
"setenv GR_HOME /software/xmgr".
(xmgr will now try to open a new Netscape session when you click on Help or
press F1. If you are already
running Netscape, just go to the URL above. Nonetheless, defining
GR_HOME will suppress an annoying error message.)
If you prefer to learn by example, there are numerous examples in
/software/xmgr/examples, and a script called "dotest" which will
give a demonstration of xmgr's features by applying xmgr to the data
and parameter sets in that directory. Type "dotest" in that directory;
use F3 to kill the current graph and go on to the next one.
Finally, there is a world-wide listserv where you can post sticky
questions. To subscribe send email to:
Majordomo@admin.ogi.edu
with the following command in the body of your email message:
subscribe acegr Firstname Lastname email-address
To get off the list send:
unsubscribe acegr email-address
More Tricks
-
To pipe data from a program:
prog | xmgr -source stdin
-
To use a template (parameter file):
xmgr -param file.par file.dat
-
To print in batch mode:
grbatch file
(setenv GR_HDEV 2 for postscript portrait; default is 1 = landscape)
-
With NCD terminals, use -GXinvert to see rubber bands and focus markers
-
With RS/6K can use -bs to fake backing store instead of redrawing on
expose events.
-
How to digitize images:
-
Scan image on MAC; convert to TIFF/GIF/JPEG
-
Display image on unix with xv
-
Save as X bitmap using xwd -bitmap > file (click on unobscured window)
(Note: xv-generated xbm files don't work - xmgr can't read them)
-
In xmgr use Graph/Graph Ops/Image to read xwd file
-
Use Data/Point Ops/Add to click on points and add to any set
(Note: Don't select "Paint Points"; seems to be buggy)
-
Write set to disk.
Command Line Arguments:
(output of "xmgr -usage")
XMgr v3.01pl7
(C) Copyright 1991-1995 Paul J Turner
All Rights Reserved
Usage of xmgr command line arguments:
-maxsets [number_of_sets] Set the number of data sets per graph (minimum is 30)
-maxgraph [number_of_graphs] Set the number of graphs for this session (minimum is 10)
-autoscale [x|y|xy] Override any parameter file settings
-noauto [x|y|xy] Supress autoscaling for the specified axis
-arrange [rows] [cols] Arrange the graphs in a grid rows by cols
-cols [cols]
-rows [rows]
-batch [batch_file] Execute batch_file on start up
-noask Assume the answer is yes to all requests - if the operation would overwrite a file, ACE/gr will do
with out prompting
-pipe Read data from stdin on startup
-logwindow Open the log window
-nologwindow No log window, overrides resource setting
-device [hardcopy device number]
-hardcopy No interactive session, just print and quit
-eps Set the PostScript driver to write EPS
-log [x|y|xy] Set the graph type to logarithmic
-legend [load] Turn the graph legend on
-printfile [file for hardcopy output]
-graph [graph number] Set the current graph number
-graphsets [number_of_sets] Set the number of data sets for the current graph
-graphtype [xy|bar|stackedbar|hbar|stackedhbar] Set the type of the current graph
-world [xmin ymin xmax ymax] Set the user coordinate system for the current graph
-view [xmin ymin xmax ymax] Set the viewport for the current graph
-results [results_file] write the results from regression to results_file
-source [disk|pipe|stdin] Source of next data file
-param [parameter_file] Load parameters from parameter_file to the current graph
-pexec [parameter_string] Interpret string as a parameter setting
-type [xy|xydx|xydy|xydxdx|xydydy|hilo] Set the type of the next data file
-ihl [ihl_file] Assume data file is in IHL format (local)
-xy [xy_file] Assume data file is in X Y format - sets are separated by lines containing non-numeric data
-nxy [nxy_file] Assume data file is in X Y1 Y2 Y3 ... format
-xydx [xydx_file] Assume data file is in X Y DX format
-xydy [xydy_file] Assume data file is in X Y DY format
-xydxdx [xydxdx_file] Assume data file is in X Y DX1 DX2 format
-xydydy [xydydy_file] Assume data file is in X Y DY1 DY2 format
-xydxdy [xydxdy_file] Assume data file is in X Y DX DY format
-xyz [xyz_file] Assume data file is in X Y Z format
-xyd [xyd_file] Assume data file is in X Y density format
-xyr [xyr_file] Assume data file is in X Y RADIUS format
-rawspice [rawspice_file] Assume data is in rawspice format
-block [block_data] Assume data file is block data
-bxy [x:y:etc.] Form a set from the current block data set using the current set type from columns given in the argument
-hilo [hilo_file] Assume data is in X HI LO OPEN CLOSE format
-boxplot [boxplot_file] Assume data is in X MEDIAN Y1 Y2 Y3 Y4 format
-netcdf [netcdf file] Assume data file is bnetCDF format
-netcdfxy [X var name] [Y var name] If -netcdf was used previously, read from the netCDF file, 'X var name' and 'Y var name' and create a
set. If 'X var name' equals "null" then load the index of Y to X
-rvideo Exchange the color indices for black and white
-mono Run xmgr in monochrome mode (affects the display only)
-seed [seed_value] Integer seed for random number generator
-GXxor Use xor to draw rubberband lines and graph focus markers
-GXinvert Use invert to draw rubberband lines and graph focus markers
-bs Do backing store
-nobs Suppress backing store
-dc Allow double click operations on the canvas
-nodc Disallow double click operations on the canvas
-maxcolors [max_colors] Set the number of colors to allocate (minimum is 17)
-redraw Do a redraw for refreshing the canvas when the server doesn't do backing store
-noredraw Don't do a redraw for refreshing the canvas when the server doesn't do backing store
-debug [debug_level] Set debugging options
-image [image_file] Argument is the name of an X Window dump (.xwd format)
-imagexy [X] [Y] Arguments are the position of the image in pixels, where (0,0) is the upper left corner of the display
and y increases down the screen
-noprint In batch mode, do not print
-usage This message