On Sep 21, 2012, at 4:11 PM, eliza botto wrote:

> 
> Dear useRs,
> 
> my question could be very basic for which i apologize in advance. 
> Each column of a matrix with dimensions 365 rows and 37 columns was drawn 
> against another matrix of dimensions 365 rows and 1 column. with that i was 
> able to draw 37 curves on the same axis. 
> now i want to draw an average curve of these 37 curves on the same axis in 
> such a way that all the curves (average and 37 curves) should appear on the 
> same axis at the same time. 
> i used
> 
>> par(new=TRUE)
> 
> But it has 2 limitations
> 
> 1- it completly distorted y-axis values
> 2- it was not very efficient as average curve in no overlapped the original 
> curves.
> 
> can any1 advise me what to do?

If you are going to use par(new=TRUE) you must make sure your 'xlim' and 'ylim' 
are the same in the second plot as in the original plot. In your misadventure, 
the ylim for the means was probably much more narrow than in the original data. 
Or to do it easily, follow Rui Barradas' advice.

Or you could `rbind` the `rowMeans` to the original data before using `matplot`.
Perhaps:

matplot(x=mat1, y= rbind(mat2, rowMeans(mat2) ) )

-- 

David Winsemius, MD
Alameda, CA, USA

______________________________________________
R-help@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.

Reply via email to