-------------------------------------------------------------------------------
help for plotmatrix
-------------------------------------------------------------------------------

Plot values of a matrix as different coloured blocks

plotmatrix , mat(matrix_name) [ split(numlist) color(colorstyle) nodiag addbox(numlist) upper lower distance(varname) dunit(string) maxticks(#) ]

Description

This command will display the values of a matrix using twoway area. Each value of the matrix will be represented by a coloured rectangular block. A legend is automatically created using percentiles but the user can also specify how to split the data.

For genetic data there is an additional function to show the genomic distances between markers. The genomic position is entered using the distance() option.

Updating this command

To obtain the latest version click the following to uninstall the old version

ssc uninstall plotmatrix

And click here to install the new version

ssc install plotmatrix

Options

mat(matrix_name) specifies the name of the matrix to plot. Note that for matrices e(b) and e(V) the user must create a new matrix using the matrix command.

split(numlist) specifies the cutpoints used in the legend. Note that if the matrix contains values outside the range of the number list then the values will not be plotted. The default will be a number list containing the min, max and 10 other percentiles.

color(string) specifies the colour of the blocks used. The default colour is bluish gray. Note that RGB and CMYK colors are not accepted and colors should be specified by the word list in colorstyle e.g. brown.

nodiag specifies that the diagonal of the matrix is not represented in the graph.

addbox(numlist) specifies that areas of the graph will be enclosed within a box. The arguments of this option are groups of 4 numbers representing the (y,x) points of two extreme vertices of the box.

upper specifies that only the upper diagonal matrix be plotted.

lower specifies that only the lower diagonal matrix be plotted.

distance(varname) specifies the physical distances between rows/columns in the matrix. This is mostly useful for plotting a pairwise LD matrix to include the genomic distances between markers.

dunit(string) specifies the units of the distances specified in the distance variable. The default is Megabases but can be any string.

maxticks(#) specifies the maximum number of ticks on both the y and x axes. The default is 8.

Examples

Plotting the values of a variance covariance matrix

sysuse auto <--- click this first to load data

reg price mpg trunk weight length turn, nocons

mat regmat = e(V)

plotmatrix, m(regmat) c(green) ylabel(,angle(0))

Plotting the values of a correlation matrix of a given varlist

matrix accum R = price mpg trunk weight length turn , nocons dev

matrix R = corr(R)

plotmatrix, m(R) s(-1(0.25)1) c(red)

Genetic Examples

Plotting the values of a point-wise LD map (see command pwld), with boxes around two areas defined by variables 1-5 and variables 11-18.

.pwld l1_1-l76_2, mat(grid) .plotmatrix, mat(grid) split( 0(0.1)1 ) c(gray) nodiag addbox(1 1 5 5 11 11 18 18)

Using the same data as above there were also map positions within the variable posn. Thus the genomic map could be displayed as a diagonal axis with the following command

.plotmatrix , mat(grid) split( 0(0.1)1 ) c(gray) nodiag save l distance(posn) dunit(Mb)

Author

Adrian Mander, MRC Human Nutrition Research, Cambridge, UK.

Email adrian.mander@mrc-hnr.cam.ac.uk

See Also Related commands:

plotbeta (if installed), cdfplot (if installed), graphbinary (if installed), palette_all (if installed).