4. The XGobi/XploRe Link


4.1 Starting XGobi through XploRe

Here is an example that starts XGobi from within XploRe. We create 100 uniformly distributed random points with random glyphs, sizes, and colors in XploRe and pass this information into XGobi:


  library("rpclib")

  free (xgobidisp)

;

  XGobiData = uniform (100,5)

  setmaskp (XGobiData, floor(7*uniform(100)), floor(16*uniform(100)), floor(15*uniform(100)) + 1)

;

  XGobiColormap = setxgobicolormap()

  serverport = createportnumber()

  clientport1 = createportnumber()

;

  rpcstartserver (serverport)

  rpcstarttimer (100, 0, "XGobiTimer")

;

  sysstr = "$XGOBIDIR/bin/xgobi -server " + serverport

  sysstr = sysstr + " -client " + clientport1 + " -link xplore &"

  systemcall (sysstr)

  ;

  systemcall ("sleep 3")

  ;

  xg1 = rpcstartclient (clientport1)

;

  xgobisendmatrix (xg1, XGobiData, "XGobiData")

;

  d = createdisplay(1, 1)

  show (d, 1, 1, XGobiData)

  setgopt (d, 1, 1, "brushsize", 10 | 10)

  setmode (d, 1, 1, 1)

;

  rpclink (d, 1, 1, xg1, clientport1)

This will result in the following (or a very similar) display where the left window contains the XploRe view and the right window contains the XGobi view:


788

See Section 4.4 for more details on linked brushing and an explanation how symbols are mapped between the two programs.


4.2 Starting XploRe through XGobi

Start up XGobi from within a UNIX shell with a command similar to


$XGOBIDIR/bin/xgobi $XGOBIDIR/data/flea &

Instead of the data file flea, any other existing data file for XGobi can be used.

This will result in the following display:


793

Now we can open the Tools menu in XGobi and start XploRe (left menu) or stop a running XploRe (right menu).


804

807

As a side effect of starting XploRe through XGobi, the XploRe objects xg1, clientport1, and XGobiColormap will be automatically created. The objects xg1 and clientport1 are set to match port sepcifications used on the XGobi side of the link. The object XGobiColormap is created by a call to the macro setxgobicolormap and adds the standard XGobi colors Red, Green, Yellow, Orange, YellowGreen, HotPink, SkyBlue, SlateBlue, Orchid, Peru, and a default color to the XploRe colormap. If you decide to use a set of different colors in XGobi, you have to modify the macro setxgobicolormap as well.


4.3 Passing XGobi Data into XploRe

Once we started the XGobi/XploRe link according to Section 4.1 or Section 4.2, we are able to pass data and the currently visible projection from XGobi into XploRe.

This has to be done using XGobi's File menu. If XploRe is not activated, this menu does not provide the XploRe (pass variables) ... and XploRe (pass projection) ... features (left menu) while, with a running XploRe, these features are available (right menu).


848

851

If we pass data from XGobi into XploRe, using the option XploRe (pass variables) ..., the XploRe objects XGobiData, XGobiVars, and XGobiInfo will be automatically created. XGobiData is a list structure with components data, pcolor, pstyle, and psize that can later be displayed in an XploRe display. XGobiVars is a vector that contains the variable names used in XGobi. XGobiInfo is a list structure with components xplcolor, xplsymbol, and xplsize. It is only used temporarily.

Similarly, if we pass a projection from XGobi into XploRe, using the option XploRe (pass projection) ..., the XploRe objects XGobiProjection and XGobiInfo will be automatically created. What has been said about XGobiData in the previous paragraph also holds for XGobiProjection.

Please be aware that each time you select XploRe (pass variables) ... (or XploRe (pass projection) ...), the previously assigned values to XGobiData, XGobiVars, and XGobiInfo (or XGobiProjection and XGobiInfo) will be overwritten. Of course, you can reassign any of these variables to another variable and then handle multiple projections in XploRe for example. Of course, you can also pass data and a projection without overwriting the other variable.


4.4 Linked Brushing

Let us assume we followed Section 4.2 and Section 4.3. Now the XGobi data can be displayed in XploRe. This can be achieved through the following XploRe commands:


  d = createdisplay(1, 1)

  show (d, 1, 1, XGobiData)

  setgopt (d, 1, 1, "brushsize", 10 | 10)

  setmode (d, 1, 1, 1)

  rpclink (d, 1, 1, xg1, clientport1)

In this sequence we create a new display, show the data, set XploRe brushing options and link the XGobi and XploRe displays.

This will result in the following (or a very similar) display where the left window contains the XploRe view and the right window contains the XGobi view:


916

We can now select XGobi's View: Brush menu and select any color and glyph from its Color and Glyph submenu. Options are:


919

922

Any combination of color and glyph that is available in XGobi also exists in XploRe. Therefore, points in both views will be brushed identically. However, note that the default color in XGobi is white, but it is black in XploRe.

After a few steps (we brushed both in the XGobi and the XploRe view), our windows may look similar to the following figure:


937

So, do the XGobi and the XploRe view always show the same symbols? The answer is ``No''.

XploRe colors can be selected from the full RGB color palette while XGobi only supports 10 colors plus a default color. Also, XploRe supports 16 plotting symbols and 16 plotting sizes while XGobi only uses 6 glyphs, and 5 sizes. The following mappings have been used to match colors, symbols (in XploRe) / glyphs (in XGobi), and sizes as good as possible:

Color: Since XGobi just supports a set of 10 colors whereas XploRe supports a whole color palette (normally with 256 colors) we need a special routine to map colors. A color is mapped from the RGB color model to an existing XGobi color using a minimum weighted distance to determine the "nearest" XGobi color in the RGB color cube.

Symbols (Glyphs): The XploRe symbols 11, 5, 2, 7, 3, and 8 are directly related to glyphs used in XGobi. The remaining XploRe symbols are mapped to XGobi Glyph 8 (Medium X).

Size: The 16 XploRe sizes xsize are mapped to the 5 XGobi sizes xgobisize according to the formula: xgobisize = (int) ((xsize - 2) / 3.0 + 0.5) Alternatively, XploRe sizes are calculated from XGobi sizes according to the appropriate inverse transformation.

The following figure shows how all 16 XploRe plotting symbols and 16 plotting sizes are mapped to XGobi. It should also explain the different views in Section 4.1.


4.5 Use of XploRe Smoothers in XGobi

We make use of the RPC mechanism to support external (XploRe) smoothers in XGobi. XGobi itself has only four built-in smoothers: the running mean, the running median, the Nadaraya-Watson kernel estimator, and a spline estimator (The Fortran code for the spline comes from Jim Ramsay and was taken from the package PSPLINE from the STATLIB S archive at http://lib.stat.cmu.edu/S/pspline).

Through the link, seven additional univariate smoothers that are part of XploRe can be selected in XGobi. These smoothers are the linear regression, the symmetrized k-nearest neighbour smoother, the k-nearest neighbour smoother, the local polynomial smoother, the lowess smoother, the neural network smoother, and the isotonic smoother.


990

993

When the link to XploRe is not active, only the four smoothers listed on top of XGobi's Smoothers menu can be selected since they are a built-in component of XGobi. The other seven smoothers are available when the XGobi/XploRe link is active.

The next XGobi display shows the previously introduced flea data set where data in each color group has been smoothed using the XploRe linear regression smoother.


1008

The symmetrized k-nearest neighbour smoother and the k-nearest neighbour smoother differ in the choice of data points they use for computation. E.g., if we take k=7 then the symmetrized k-nearest neighbour smoother will take the data point itself and 3 data points left and right from the actual data point. In contrast, the k-nearest neighbour smoother will take the data point itself and the six nearest data points (in the L2 sense) for smoothing.

The Nadaraya-Watson smoother is a local constant smoother (of order 0), the lowess smoother is a local linear smoother (of order 1), and the local polynomial smoother is a local cubic smoother (of order 3).

The neural network (The C code of Brian Ripley has been used.) smoother is a single hidden layer network where the number of hidden neurons can be influenced. The weight decy is set to 0.001. In contrast to all other smoothers, this smoother may deliver different results each time it is applied to the same data. Because of a random initialization of the weights of the network we may end up after training the network with a slightly different network each time. These networks produce different predictions, especially if we only have a small number of data points.

The isotonic smoother is a monotone regression smoother which is always monotone ascending.


4.6 Multiple Linked Windows

Within one session we can link multiple XploRe displays with one XGobi window or have individual XploRe displays that relate to different XGobi windows.

Let us assume we followed Section 4.2 and Section 4.3. Let us assume we passed data and a projection from XGobi into XploRe. Then, this data and projection can be displayed in XploRe. This can be achieved through the following XploRe commands:


  d = createdisplay(1, 1)

  e = createdisplay(1, 1)

;

  show (d, 1, 1, XGobiData)

  setgopt (d, 1, 1, "brushsize", 10 | 10)

  setmode (d, 1, 1, 1)

  rpclink (d, 1, 1, xg1, clientport1)

;

  show (e, 1, 1, XGobiProjection)

  setgopt (e, 1, 1, "brushsize", 10 | 10)

  setmode (e, 1, 1, 1)

  rpclink (e, 1, 1, xg1, clientport1)

;

  link (d, 1, 1, e, 1, 1)

  link (e, 1, 1, d, 1, 1)

In this example we create two XploRe displays, show our data, and link each of the displays with the XGobi window. The last two lines are required to enable linked brushing within XploRe.

As a result, we may obtain a display similar to the following figure. The upper left XploRe display (d) shows the original data, the lower left XploRe display (e) shows the projection that is also visible in the right XGobi.


1049

We can now continue with the Grand Tour in XGobi and brush in either of the windows. After a few steps we may have a result similar to the following figure:


1052



Method and Data Technologies   MD*TECH Method and Data Technologies
  http://www.mdtech.de  mdtech@mdtech.de