SOM Toolbox Online documentation http://www.cis.hut.fi/projects/somtoolbox/

# som_vis_coords

### Syntax

```  Co = som_vis_coords(lattice, msize)

```

### Description

``` This function calculates the coordinates of map units in 'hexa' and
'rect' lattices in 'sheet' shaped map for visualization purposes. It
differs from SOM_UNIT_COORDS in the sense that hexagonal lattice is
calculated in a "wrong" way in order to get integer coordinates for
the units. Another difference is that it may be used to calculate
the coordinates of units _and_ the center points of the lines
connecting them (edges) by using 'hexaU' or 'rectU' for lattice.
This property may be used for drawing u-matrices.

The unit number 1 is set to (ij) coordinates (1,1)+shift
2                            (2,1)+shift

... columnwise

n-1th                        (n1-1,n2)+shift
nth                            (n1,n2)+shift

where grid size = [n1 n2] and shift is zero, except for
the even lines of 'hexa' lattice, for which it is +0.5.

For 'rectU' and 'hexaU' the unit coordinates are the same and the
coordinates for connections are set according to these. In this case
the ordering of the coordinates is the following:
let
U  = som_umat(sMap); U=U(:); % make U a column vector
Uc = som_vis_coords(sMap.topol.lattice, sMap.topol.msize);
now the kth row of matrix Uc, i.e. Uc(k,:), contains the coordinates
for value U(k).

```

### Required input arguments

```  lattice  (string) The local topology of the units:
'hexa', 'rect', 'hexaU' or 'rectU'
msize    (vector) size 1x2, defining the map grid size.
Notice that only 2-dimensional grids
are allowed.

```

### Output arguments

```  Co       (matrix) size Mx2, giving the coordinates for each unit.
M=prod(msize) for 'hexa' and 'rect', and
M=(2*msize(1)-1)*(2*msize(2)-1) for 'hexaU' and 'rectU'

```

### Features

``` Only 'sheet' shaped maps are considered. If coordinates for 'toroid'
or 'cyl' topologies are required, you must use SOM_UNIT_COORDS

```

### Examples

``` Though this is mainly a subroutine for visualizations it may be
used, e.g., in the following manner:

% This makes a hexagonal lattice, where the units are rectangular
som_cplane('rect',som_vis_coords('hexa',[10 7]),'none');

% Let's make a map and calculate a u-matrix:
sM=som_make(data,'msize',[10 7],'lattice','hexa');
u=som_umat(sM); u=u(:);
% Now, these produce equivalent results:
som_cplane('hexaU',[10 7],u);
som_cplane(vis_patch('hexa')/2,som_vis_coords('hexaU',[10 7]),u);

```