开发者

What is the equivalents of matlab's pcolor in R?

I have a 16x16 matrix of grayscale values representing handwriting digits. Is there a plot in R that I can use to visualize it?

Matlab has pcolor, I am lookin开发者_运维技巧g for something along those lines. pcolor


No need to go to extra packages. Base R already has this, see

  • help(image)

  • help(heatmap)

and Romain's excellent R Graph Gallery which has a searchable index.


There are many options for something like this. One option is to use the geom_tile in ggplot2:

library(ggplot2)
ggplot(melt(volcano), aes(x=X1, y=X2, fill=value)) + geom_tile()

Ends up looking like this:

What is the equivalents of matlab's pcolor in R?


(source: had.co.nz)

Some other options include: levelplot (in lattice) or color2D.matplot (in plotrix).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜