Hi, I apologise in advance for the na?ve question. I have large matrices that I want to plot. I currently use color2D.matplot. However, these matrices contain many values of no interest (i.e. where there is no data, the figure -999 is automatically displayed). Is there any way of removing these from the matrices to be plotted by matplot? An obvious possibility is setting them all to 0, but that introduces 'false data'. I also see that matplot does not have a way of dealing with NaNs. Is this actually the case? Thanks in advance for any help you can give me!! Bernardo
What do you mean by removing them? Do you want the whole row/column deleted? Have you tried setting them to NA so that the points are not plotted? You have to be a little more specific on what type of action you want to have happen when the criteria is met. Of course the answer is "anything is possible in R". On Wed, Oct 15, 2008 at 6:19 AM, Garcia Carreras, Bernardo <bernardo.garcia-carreras08 at imperial.ac.uk> wrote:> Hi, I apologise in advance for the na?ve question. I have large matrices that I want to plot. I currently use color2D.matplot. However, these matrices contain many values of no interest (i.e. where there is no data, the figure -999 is automatically displayed). Is there any way of removing these from the matrices to be plotted by matplot? An obvious possibility is setting them all to 0, but that introduces 'false data'. I also see that matplot does not have a way of dealing with NaNs. Is this actually the case? Thanks in advance for any help you can give me!! > > Bernardo > > ______________________________________________ > 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 that you are trying to solve?
Hi, two days ago I have asked the list if there is a better way to plot a matrix using the following plot command: plot(matrix[1,], type="l") for (i in 2:dim(matrix)[1]) { lines(matrix[i,], type="l") } I have been told to use the matplot function, but unfortunately I matplot does not plot my matrix as I would like the matrix to be plotted... Each row in the matrix should be plotted as a time series plot. The columns should reflect the "time" The matrix looks like this: [,1] [,2] [,3] [,4] [,5] [,6] [1,] 10.795525 17.742121 -1.668664 7.410594 10.229107 -0.7402613 [2,] 9.335885 10.472469 9.503561 9.815167 16.073518 21.1387238 [3,] 16.818605 5.354479 10.921837 5.202947 4.730314 2.3975041 [4,] 9.773960 10.081033 3.538419 16.913288 10.623028 7.8052165 [5,] 8.473132 13.775806 3.739209 15.224250 6.339220 7.3409747 I tried this with matplot: m <- matrix(rnorm(30, 10, 5), ncol=6) time <- matrix(rep(1:6,5), nrow=5, byrow=TRUE) matplot(time, m, type="l", col="black") Any help would be appreciate! Thanks! -- View this message in context: http://www.nabble.com/Help-with-matplot-tp20481662p20481662.html Sent from the R help mailing list archive at Nabble.com.