开发者

Plotting a heat map for an upper or lower triangular matrix

Can any body suggest a function to plot heat map for upper or lower triangular matrix开发者_JS百科 in R


The most basic way to do something like this would be using ?image as follows:

M <- matrix(runif(100),10,10)
M[lower.tri(M)] <- NA
image(1:10,1:10,M)

which would result in something like this:

Plotting a heat map for an upper or lower triangular matrix

You could also investigate the functions ?heatmap or in the gplots package ?heatmap.2. Doing this using ggplot2 using geom_tile is a little different but you can find some examples to walk you through the process here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜