looking for a graph command

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

looking for a graph command

Taka Matzmoto
Hi R users

I am looking for a command or function that draws a graph based on a
correlation matrix or any lower or upper diagonal matrix.

If I have 5 variables (X1, X2, X3, X4, and X5) there are 10 unique
correlation values

I like to draw some kind of a gird graph based on these values, using (1,2)
(1,3), (1,4), (1,5), ...., (4,5) as positions on the graph. If a correlation
value  is closer to 1 then the color for the value is getting black.  If a
correlation value  is closer to zero then the color for the value is getting
white.

Is there any graphic package allowing for doing that ?

TM.

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search!


______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: looking for a graph command

Martin Sandiford
Maybe something like this will do what you want:

 > x <- matrix(NA, 5, 5)
 > x[upper.tri(x)] <- runif(10)
 > image(1-t(x)[,ncol(x):1], col=gray.colors(100), axes=FALSE)

Martin

On 18/02/2006, at 5:38 PM, Taka Matzmoto wrote:

> Hi R users
>
> I am looking for a command or function that draws a graph based on a
> correlation matrix or any lower or upper diagonal matrix.
>
> If I have 5 variables (X1, X2, X3, X4, and X5) there are 10 unique
> correlation values
>
> I like to draw some kind of a gird graph based on these values, using
> (1,2) (1,3), (1,4), (1,5), ...., (4,5) as positions on the graph. If a
> correlation value  is closer to 1 then the color for the value is
> getting black.  If a correlation value  is closer to zero then the
> color for the value is getting white.
>
> Is there any graphic package allowing for doing that ?
>
> TM.
>
> _________________________________________________________________
> Don’t just search. Find. Check out the new MSN Search!
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: looking for a graph command

Duncan Murdoch
In reply to this post by Taka Matzmoto
On 2/18/2006 2:08 AM, Taka Matzmoto wrote:

> Hi R users
>
> I am looking for a command or function that draws a graph based on a
> correlation matrix or any lower or upper diagonal matrix.
>
> If I have 5 variables (X1, X2, X3, X4, and X5) there are 10 unique
> correlation values
>
> I like to draw some kind of a gird graph based on these values, using (1,2)
> (1,3), (1,4), (1,5), ...., (4,5) as positions on the graph. If a correlation
> value  is closer to 1 then the color for the value is getting black.  If a
> correlation value  is closer to zero then the color for the value is getting
> white.
>
> Is there any graphic package allowing for doing that ?

library(ellipse)
plotcorr(cor(cbind(X1,X2,X3,X4,X5)))

You can set the colours of the individual entries using the col argument.

Duncan Murdoch

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html