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
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:
(source: had.co.nz)
Some other options include: levelplot
(in lattice) or color2D.matplot
(in plotrix).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With