Learn R Programming

NeatMap (version 0.1)

lineplot: Line plots of profiles in a grid of embedded results

Description

A 2d embedding of rows of given matrix is gridded and line plots of the profiles of the points within each cell are displayed

Usage

lineplot(pos, profiles, n.div.x = 10, n.div.y = 10, normalize = F, 
ylim=NULL, clipped=F)

Arguments

pos
2d positions of rows
profiles
Matrix of data to be plotted
n.div.x
Number of grid boxes in x direction
n.div.y
Number of grid boxes in y direction
normalize
logical: if true, the profiles are normalized before plotting
ylim
a vector of length 2 containing the profile values that correspond to the top and bottom of the grid boxes, if NULL the largest and smallest values in profile are used
clipped
logical: If TRUE, then values exceeding ylim are clipped

Value

  • Returns a ggplot2 plot of class ggplot.

Details

pos is assumed to be the embedding/2 dimensional representation of the rows of profiles. The pos result is then placed in a uniform grid with the number of divisions in the x and y directions specified by n.div.x and n.div.y respectively. Then in each grid cell the profiles for all the points in it are displayed together. Missing data is not plotted. The grid extends 5 percent of the difference between the max and min point beyond these points. In each cell 90 percent of its width is used. By default, the profiles are scaled so that the maximum and minimum values (in profiles) would appear at the top and bottom of a cell. Different limits can be chosen using the ylim option. If clipped is true values going beyond these limits will be clipped, in order to prevent the overlap of profiles in different cells. If normalize is true, the profiles shall be normalized to have zero mean and unit variance.

Examples

Run this code
#PCA and line plot. Notice how the profiles are dominated by two high value columns
mtcars.PCA<-prcomp(mtcars);
lineplot(mtcars.PCA$x,mtcars);

#Use ylim and clipping to allow us to focus on the columns with lower values
lineplot(mtcars.PCA$x,mtcars,ylim=c(0,10),clipped=TRUE)

Run the code above in your browser using DataLab