views:

180

answers:

2

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 looking for something along those lines. pcolor

+3  A: 

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: alt text

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

Shane
Thanks a lot! I was hoping to use ggplot2, so this is a good excuse.
signalseeker
+3  A: 

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.

Dirk Eddelbuettel