[R] plot matrix

jim holtman jholtman at gmail.com
Thu Feb 14 18:23:06 CET 2008


transpose the matrix and then use 'matplot'

On 2/14/08, Marek Bartkuhn <Marek.Bartkuhn at gen.bio.uni-giessen.de> wrote:
> Dear R users,
>
>
> I like to plot a matrix A which looks like this:
>
>
>        ,1              ,2              ,3              ,4
>
> 1,      1               10              100             1000
> 2,      0.5             0.2             1.0             4.3
> 3,      0.1             0.2             0.3             0.5
>
> .....
>
>
> where the 1st row is representing the X-axis values. The subsequent
> rows should be plotted on the y-axis. I would prefer to use the
> smoothScatter plotting function of the geneplotter package, but to
> begin with R I'd be happy to use any scatterplot with the given
> dataset provided in the matrix A.
>
> So I tried:
>
> plot(A[1,],A[2:3,])
>
> or
>
> plot(A[1,],A[2-3,])
>
> both result in :
>
> Error in xy.coords(x, y, xlabel, ylabel, log) :
>   'x' and 'y' lengths differ
>
> What do I have to do?
>
> Marek
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list