Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mountain like plot for data in Square matrix

Tags:

r

ggplot2

I have data as a square matrix. I want to plot it like meshgrid in Matlab (mountains with color gradients). Also, if there is a big cliff, I want to label it. Something like shown below

enter image description here

The data I have is

            _92765  _222156 _384259 _384249 _384247 _384250
_92765  -1  3.4 4.85106 8.12927 8.462   9.12643
_222156 3.4 -1  1.50877 3.66383 3.58554 3.69655
_384259 4.85106 1.50877 -1  4.48433 4.51367 4.14421
_384249 8.12927 3.66383 4.48433 -1  0.288   0.252
_384247 8.462   3.58554 4.51367 0.288   -1  0.196
_384250 9.12643 3.69655 4.14421 0.252   0.196   -1

How can I go about it? Thanks

like image 918
y2p Avatar asked Mar 03 '11 20:03

y2p


1 Answers

Have you looked at the wireframe() function in the lattice library?

Here is an example from the on-line help:

library(lattice)    
wireframe(volcano, shade = TRUE,
    aspect = c(61/87, 0.4),
    light.source = c(10,0,10))

enter image description here

like image 125
Andrie Avatar answered Oct 10 '22 17:10

Andrie