[R] Plot a Matrix as an Image with ggplot
alaios at yahoo.com
Thu Feb 14 16:15:05 CET 2013
I am trying to plot a matrix I have as an image
num [1:21, 1:66] 0 0 0 0 0 0 0 0 0 0 .
that contains only 0s and 1s,
where the xlabel will be Labeled as
num [1:66] 1e+09 1e+09 1e+09 1e+09 1e+09 ...
and the yLabels will be labeled as
num [1:21] -88 -87 -86 -85 -84 -83 -82 -81 -80 -79 ...
I have found on the internet that I can do something like that with ggplot2.
you can run the following
What I see missing here is to get my matrix and transform it to a data frame with labels for x and y axis so as ggplot can print the values nice. If you get the idea this matrix will be printed as a two tile pattern let's say with black tiles zeros and white tiles black where a color bar will depicting that black means zero and white one.
To help you with my code you will find attached the three items I have discussed here, the matrix, the x and the y labels.
Could you please help me with that?
More information about the R-help