[R] how to plot a list in graphs

Deepayan Sarkar deepayan.sarkar at gmail.com
Mon Nov 21 21:42:51 CET 2005


On 11/21/05, peter eric <eric_wzl at yahoo.com> wrote:
> hi all,
>   I have a matrix and named each row and column as like below...
>
>    a<-matrix(c(seq(3,45,3),seq(10,6,-1)),4,5,byrow=F)
> > col<-c("peter","david","richrd","vincent","selva")
> > rows<-c("julius","caeser","anja","maya")
> > dimnames(a)<-list(rows,col)
> > a
>          peter david richrd vincent selva
> julius     3    15     27      39     9
> caeser   6    18     30      42     8
> anja       9    21     33      45     7
> maya   12    24     36      10     6
>
>   How I can plot this in graphs like julius Vs peter and so on..
>
>   whether it could ne done with image function?..

Sure, how about

image(a)

If you want the axes to be labelled appropriately, it might be easier with

library(lattice)
levelplot(a)

or perhaps

levelplot(a, scales = list(x = list(rot = 90)))

-Deepayan




More information about the R-help mailing list