xgvis {xgobi} | R Documentation |
R interface to XGvis
, an interactive multidimensional scaling
(MDS) program that consists of a control panel to manipulate the
parameters of the MDS stress function and an xgobi
window for data display. It can be used either for visualization of
dissimilarity data, for dimension reduction, or for graph layout.
Graph layout is usually done in 2D, but xgvis
allows layouts in
arbitrary dimensions, 3D being the default. It permits missing
values, which can be used to implement multidimensional unfolding.
xgvis(dmat = NULL, edges= NULL, pos = NULL, rowlab = colnames(dmat), colors = NULL, glyphs = NULL, erase = NULL, lines = NULL, linecolors = NULL, resources = NULL, display = NULL, multi = TRUE, keep = FALSE, fprefix = "xgvis-")
dmat |
numeric n * n distance matrix. |
edges |
n * 2 or n * 3 matrix of
specifications for the pattern of line segments which
connect pairs of points. Must contain at least two numbers per
line. The first two numbers represent the row numbers of the two
points that should be connected. (This is exactly like the structure
of a the lines argument of xgobi .) In addition,
if a third number is present, it is taken to be an edge weight.
If edges is specified and dmat not, then
the distance matrix is computed from edges , with each
edge representing a distance of one.
|
pos |
Starting positions: an n * p matrix.
If pos is specified and dmat not,
the distance matrix is computed from pos . |
rowlab |
character vector of n row labels (defaulting to those of
dmat ); if no default exists, xgobi constructs
its own (numbers 1:n ). |
colors |
optional character vector supplying initial point colors
to be used; see xgobi . |
glyphs |
integer vector, used to supply glyphs to be used on
startup, see xgobi . |
erase |
Optional integer vector of length equal to the number of rows in the data and composed of 1s and 0s. A 1 in position i specifies that point i should be erased. The default is a vector of 0s. |
lines |
Optional integer matrix, n by 2, which specifies by row number
pairs of points to be connected by line segments.
If lines are specified, then the edges is used to create
the distance matrix but lines is used to draw the edges.
|
linecolors |
Optional integer vector, of length n where n is the number of
lines specified by the lines argument. It is used to supply
line colors to be used on startup; the default is for all the
lines to be drawn in the standard foreground color.
|
resources |
Optional character vector created by clicking on the ``Save Resources'' button in XGobi. |
display |
Optional character string, identifying the monitor on which to display
the xgvis window. The default is "machine:0.0" where
machine is the name of the user's workstation. See
documentation for X.
|
multi |
logical, indicating if the xgobi process should be
run multi-tasking with R. If true, control returns to the R
command prompt after 3 seconds. |
keep |
logical, indicating if the temporary files should be kept
(e.g. for calling the xgobi program outside R) |
fprefix |
character string for the file name prefix to be used for temporary files. |
The UNIX status
upon completion, i.e. 0
if ok.
The xgvis R function executes a call to the C program of the same name, and returns control of the R command line to the user.
D. F. Swayne dfs@research.att.com
of R port: Kurt Hornik and Martin Maechler maechler@stat.math.ethz.ch
http://www.research.att.com/areas/stat/xgobi/,
http://www.public.iastate.edu/~dicook/
data(morsecodes) ## from the XGobi/XGvis data, see ?morsecodes mc.row <- paste(morsecodes.row[,1],morsecodes.row[,2]) xgvis(dmat = morsecodes.dist, pos = morsecodes.pos, rowlab = mc.row, colors = morsecodes.colors, glyphs = morsecodes.glyphs, lines = morsecodes.lines, linecolors = morsecodes.linecolors) ##> 2) Show lines by hitting "l" with the mouse over the plot. ##> 3) Examine morsecode labels by hitting "i" and mousing around on the plot. ##> 3b) Press "r" (on the plot) to switch 3D rotation in xgobi. ##> 4) Run MDS in 3D by clicking "Run MDS" (in xgvis). ##> 5) Speed up the optimization by increasing the "Stepsize" with the slider. ##> The "Stress function" value may go as low as 0.1925 (MM). ##> 6) When the optimization calms down, click "Run MDS" to toggle MDS off. ##> 7) Rotate the MDS configuration in 3D {by "r" with mouse over plot}. ##> 8) Increase the rotation speed with the slider in the top left and ##> control the rotation direction by dragging the mouse on the plot. ##> 9) You can check out the initial configuration by ## In order to have no color warning : Mcolors <- unique(morsecodes.colors) (Mcolors <- paste("*brushColor", 0:(length(Mcolors)-1),": ", Mcolors, sep="")) xgobi(morsecodes.pos, collab = morsecodes.col, rowlab = mc.row, colors = morsecodes.colors, glyphs = morsecodes.glyphs, lines = morsecodes.lines, linecolors = morsecodes.linecolors, resources= c("*showLines: True", Mcolors)) ##> This XGobi window will be linked with ##> the XGvis window for glyph-color brushing and labeling.