[R] modify rectangle color from image
Hi, I need some suggestion on how I could modify the color on some rectangle that I have created using image. In other words, I have a 5x5 matrix, say, m. m - matrix(rnorm(25), nrow=5) I create a grid of rectangles by: image(m) Now I want to change the color of rectangle (3,3) to blue. I don't know how this could be done, and searching the web has given me no hint. Thanks for your help. -- saurav __ R-help@stat.math.ethz.ch 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.
Re: [R] modify rectangle color from image
Thanks, Saurav Saurav Pathak [Wed, Jan 24, 2007 at 04:37:20PM -0500]: + Hi, + + I need some suggestion on how I could modify the color on some + rectangle that I have created using image. + + In other words, I have a 5x5 matrix, say, m. + + m - matrix(rnorm(25), nrow=5) + + I create a grid of rectangles by: + + image(m) + + Now I want to change the color of rectangle (3,3) to blue. using rect for this. DUH. -- saurav __ R-help@stat.math.ethz.ch 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.
[R] 3d scatterplots of more than 1 data set
hi, i am need to plot two or more sets of data in a 3d scatterplot, each set with different color. i tried Rcmdr, and the 3d scatterplot facility, based on rgl. that is what i need. but i cannot seem to code different sets of data differently. any help will be very helpful. i tried scatterplot3d, but it is difficult to get the right angle in it. i need to be able to rotate the axes, and export an eps file from the right angle. thanks in advance. -- saurav __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] multi-color plot
hi all, i am trying to make multi-color plots. that is, i generally use, plot(x, y, type=n) text(x, y, labels=class) here, the vector class denotes the class of each point. there are usually 3-4 classes of points. how may i display the different classes in different colors? thanks for any help. -- saurav __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] multi-color plot
Thus spake Sundar Dorai-Raj: + R plot(x=1:26,y=rep(0:1,13),type=n) + R text(x=1:26,y=0.5,labels=letters,col=terrain.colors(26)) now i get it. what i am doing now is: R mycol - cls R mycol[mycol==0] - red R mycol[mycol==1] - blue R mycol[mycol==2] - green R plot(x, y, type=n) R text(x, y, labels=cls, col=mycol) which is exactly what i wanted. thanks!! saurav __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] loading functions from files
hi, i think this is a basic question, but i did not find any documentation. i have a file, helloworld.R, which has helloworld - function() { cat(Hello World\n) } how may i load this file in R so that i may say at the prompt: helloworld() i am not yet ready to write a package. thanks, -- saurav __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] newbie question on dist
hi, i have just begun using R, so please bear with me. i am trying to use cmdscale and display the result. i read the data using read.table(), calculate the proximity matrix using dist() and the display the result using the cmdscale(). this is very fine. in addition, i want the display to distinguish between two classes of records in my data. i have my data records marked as 1 or 0. so i want to display 1's and 0's. how may i do that? i use the following code: fj - read.table(fj) names(fj) [1] V1 V2 V3 V4 V5 # V5 contains the class mark (1 or 0) # # since i dont want the class attribute in the distance matrix # i create another data.frame dropping it. but how do i pass it # so that I may use it while plotting? fjN - data.frame(V1=fj$V1, V2=fj$V2, V3=fj$V3, V4=fj$V4) library(mva) fjNDist - dist(fjN, method=euclidean) fjCMDS - cmdscale(fjNDist) plot(x, y, type=n, main=cmdscale(fjNDist)) text(x, y, ., cex=0.8) any help will be much appreciated. thanks, saurav __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help