powered by
matrix to polygon: Plot columns of a matrix as stacked areas.
mat
pol
mat2pol( pm, perm = 1:ncol(pm), x = as.numeric(rownames(pm)), col = rainbow(ncol(pm)), yl = 0:1, append = FALSE, ... )
Numerical matrix.
integer vector of length ncol(pm), used to permute the columns of pm.
ncol(pm)
pm
Numeric. The x-axis of the plot.
Colors of the areas.
y-axis limits.
Logical. Should the polygons be added to an exiating plot
Further parameters passed to plot.
plot
A matrix of ncol(pm)+1 columns with the first equal to 0, and the remaining the cumulative sum of the columns of pm[perm].
ncol(pm)+1
pm[perm]
The function is called for its side effect - the stacked polygons.
The function is originally intended to plot stacked probabilities, hence the default of 0:1 for the y-axis.
0:1
# NOT RUN { M <- cbind( sort(runif(10)), sort(runif(10)), sort(runif(10)) ) pm <- sweep( M, 1, apply(M,1,sum), "/" ) mat2pol( pm ) # }
Run the code above in your browser using DataLab