Dear All, I was looking for the color index in?image function,?such as from topo.colors(n) and etc. but still never found it. For instance, from the help menu. ########################################### # Volcano data visualized as matrix. Need to transpose and flip # matrix horizontally. image(t(volcano)[ncol(volcano):1,]) # A prettier display of the volcano x <- 10*(1:nrow(volcano)) y <- 10*(1:ncol(volcano)) image(x, y, volcano, col = terrain.colors(100), axes = FALSE) contour(x, y, volcano, levels = seq(90, 200, by = 5), ??????? add = TRUE, col = "peru") axis(1, at = seq(100, 800, by = 100)) axis(2, at = seq(100, 600, by = 100)) box() title(main = "Maunga Whau Volcano", font.main = 4) ######################################### From the script above, it yields a beautiful ?image of volcano with variety of colors but i have to list down the color index that could show the meaning of each color in my thesis. Could someone please help me to extract this color index? Thank you Fir
Dear All, I was looking for the color index in?image function,?such as from topo.colors(n) and etc. but still never found it. For instance, from the help menu. ########################################### # Volcano data visualized as matrix. Need to transpose and flip # matrix horizontally. image(t(volcano)[ncol(volcano):1,]) # A prettier display of the volcano x <- 10*(1:nrow(volcano)) y <- 10*(1:ncol(volcano)) image(x, y, volcano, col = terrain.colors(100), axes = FALSE) contour(x, y, volcano, levels = seq(90, 200, by = 5), ??????? add = TRUE, col = "peru") axis(1, at = seq(100, 800, by = 100)) axis(2, at = seq(100, 600, by = 100)) box() title(main = "Maunga Whau Volcano", font.main = 4) ######################################### From the script above, it yields a beautiful ?image of volcano with variety of colors but i have to list down the color index that could show the meaning of each color in my thesis. Could someone please help me to extract this color index? Thank you Fir
Hi, On Sat, Sep 5, 2009 at 7:06 AM, FMH<kagba2006 at yahoo.com> wrote:> Dear All, > > I was looking for the color index in image function, such as from topo.colors(n) and etc. but still never found it. For instance, from the help menu.The answer is in the code:> ########################################### > # Volcano data visualized as matrix. Need to transpose and flip > # matrix horizontally. > image(t(volcano)[ncol(volcano):1,]) > > # A prettier display of the volcano > x <- 10*(1:nrow(volcano)) > y <- 10*(1:ncol(volcano)) > image(x, y, volcano, col = terrain.colors(100), axes = FALSE)Right here: R> terrrain.colors(100) [1] "#00A600FF" "#03A700FF" "#07A800FF" "#0AAA00FF" "#0EAB00FF" ... Is that what you mean? -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
Hi, Thank you for your response. I'm looking for the names of the colors?denoted by these??codes and what?do these colors represent for. For instance, if we?use topo.colors(5) in the image function,?five different colors will be?used in which its codes are denoted as: [1] "#4C00FFFF" "#004CFFFF" "#00E5FFFF" "#00FF4DFF" "#FFFF00FF" So, my first question is what type of color do these codes represent for??Are they?white, red,...? My second question is, if we use this topo.colors(5) in image function to denote the temperature values for intance, what are these colors represent for??Does the first color, "#4C00FFFF" represent the lower/medium/higher temperature? I do hope you could advice me on this matter? Thank you Fir ----- Original Message ---- From: FMH <kagba2006 at yahoo.com> To: Steve Lianoglou <mailinglist.honeypot at gmail.com> Sent: Sunday, September 6, 2009 3:41:02 PM Subject: Re: [R] Color index in image function Hi, Thank you for your response. I'm looking for the name of the colors?denoted by this??code and what?are these colors representing for. For instance, if we?use topo.colors(5) in the image function,?five different colors will be?used in which its codes are denoted as: [1] "#4C00FFFF" "#004CFFFF" "#00E5FFFF" "#00FF4DFF" "#FFFF00FF" So, my first question is what type of color does these codes represent for??Are they?white, red,...? My second question is, if we use this topo.colors(5) in image function to denote the temperature values for intance, what are these colors represent for??Does the first color, "#4C00FFFF" represent the lower/medium/higher temperature? I do hope you could advice me on this matter? Thank you Fir ----- Original Message ---- From: Steve Lianoglou <mailinglist.honeypot at gmail.com> To: FMH <kagba2006 at yahoo.com> Cc: r-help at r-project.org Sent: Sunday, September 6, 2009 3:20:25 PM Subject: Re: [R] Color index in image function Hi, On Sat, Sep 5, 2009 at 7:06 AM, FMH<kagba2006 at yahoo.com> wrote:> Dear All, > > I was looking for the color index in image function, such as from topo.colors(n) and etc. but still never found it. For instance, from the help menu.The answer is in the code:> ########################################### > # Volcano data visualized as matrix. Need to transpose and flip > # matrix horizontally. > image(t(volcano)[ncol(volcano):1,]) > > # A prettier display of the volcano > x <- 10*(1:nrow(volcano)) > y <- 10*(1:ncol(volcano)) > image(x, y, volcano, col = terrain.colors(100), axes = FALSE)Right here: R> terrrain.colors(100) [1] "#00A600FF" "#03A700FF" "#07A800FF" "#0AAA00FF" "#0EAB00FF" ... Is that what you mean? -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
On Sat, 2009-09-05 at 04:14 -0700, FMH wrote:> Dear All, > > I was looking for the color index in image function, such as from topo.colors(n) and etc. but still never found it. For instance, from the help menu. > > > ########################################### > # Volcano data visualized as matrix. Need to transpose and flip > # matrix horizontally. > image(t(volcano)[ncol(volcano):1,]) > > # A prettier display of the volcano > x <- 10*(1:nrow(volcano)) > y <- 10*(1:ncol(volcano)) > image(x, y, volcano, col = terrain.colors(100), axes = FALSE) > contour(x, y, volcano, levels = seq(90, 200, by = 5), > add = TRUE, col = "peru") > axis(1, at = seq(100, 800, by = 100)) > axis(2, at = seq(100, 600, by = 100)) > box() > title(main = "Maunga Whau Volcano", font.main = 4) > ######################################### > > >From the script above, it yields a beautiful image of volcano with variety of colors but i have to list down the color index that could show the meaning of each color in my thesis. > > Could someone please help me to extract this color index? > > Thank you > FirIf I understand your question you need change the Palette of image plot. So you need use "colorRampPalette" look my example Brazilan.Pallete <- colorRampPalette(c("green","yellow", "blue")) image(x, y, volcano, col = Brazilan.Pallete(50), axes = FALSE) -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil
Thank you for the tips. I have manage to run your script, but? was still never get?the way to?include?the color index beside the image which could explain the intensity of the color from the lower index(green) to the higher index(blue). This color index might be represented by??an increasing of color index in another table beside the image, started from?green followed by green-yellow, yellow, yellow-blue and blue? Could?someone please advice on this matter? Cheers Fir ----- Original Message ---- From: Bernardo Rangel Tura <tura at centroin.com.br> To: FMH <kagba2006 at yahoo.com> Sent: Monday, September 7, 2009 11:13:12 AM Subject: Re: [R] Color index in image function On Sat, 2009-09-05 at 04:14 -0700, FMH wrote:> Dear All, > > I was looking for the color index in image function, such as from topo.colors(n) and etc. but still never found it. For instance, from the help menu. > > > ########################################### > # Volcano data visualized as matrix. Need to transpose and flip > # matrix horizontally. > image(t(volcano)[ncol(volcano):1,]) > > # A prettier display of the volcano > x <- 10*(1:nrow(volcano)) > y <- 10*(1:ncol(volcano)) > image(x, y, volcano, col = terrain.colors(100), axes = FALSE) > contour(x, y, volcano, levels = seq(90, 200, by = 5), >? ? ? ? add = TRUE, col = "peru") > axis(1, at = seq(100, 800, by = 100)) > axis(2, at = seq(100, 600, by = 100)) > box() > title(main = "Maunga Whau Volcano", font.main = 4) > ######################################### > > >From the script above, it yields a beautiful? image of volcano with variety of colors but i have to list down the color index that could show the meaning of each color in my thesis. > > Could someone please help me to extract this color index? > > Thank you > FirIf I understand your question you need change the Palette of image plot. So you need use "colorRampPalette" look my example Brazilan.Pallete <- colorRampPalette(c("green","yellow", "blue")) image(x, y, volcano, col = Brazilan.Pallete(50), axes = FALSE) -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil
On Wed, 2009-09-09 at 02:33 -0700, FMH wrote:> Thank you for the hints, but how could i add the grid lines which have numbers, representing the height of the volcano on the image. > > Thank you >So I think this script is what you need Brazilan.Pallete <- colorRampPalette(c("green","yellow", "blue")) require(fileds) image.plot(volcano, col = Brazilan.Pallete(50), axes = FALSE) contour(volcano, levels = seq(90, 200, by = 5), add = TRUE) -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil> > > ----- Original Message ---- > From: Bernardo Rangel Tura <tura at centroin.com.br> > To: FMH <kagba2006 at yahoo.com> > Sent: Tuesday, September 8, 2009 10:14:07 AM > Subject: Re: [R] Color index in image function > > On Mon, 2009-09-07 at 07:59 -0700, FMH wrote: > > Thank you for the tips. I have manage to run your script, but was still never get the way to include the color index beside the image which could explain the intensity of the color from the lower index(green) to the higher index(blue). This color index might be represented by an increasing of color index in another table beside the image, started from green followed by green-yellow, yellow, yellow-blue and blue? > > > > Could someone please advice on this matter? > > > > Cheers > > Fir > > > > Hi FHM, > > Well If you desire one color index in a imageplot I don't know solve > your problem. > > But in your scirptyou use image and > > image(x, y, volcano, col = terrain.colors(100), axes = FALSE) > contour(x, y, volcano, levels = seq(90, 200, by = 5), > add = TRUE, col = "peru") > > In this case I suggest you use > > Brazilan.Pallete <- colorRampPalette(c("green","yellow", "blue")) > filled.contour(volcano, color = Brazilan.Pallete)-- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil
On Thu, 2009-09-10 at 05:27 -0700, FMH wrote:> Thank you for the scripts, but the label and the values in the x and y-axis suddently dissapear even the 'axis' function is used as stated in the command below. Could you help on this? > > axis(1, at = seq(100, 800, by = 100)) > axis(2, at = seq(100, 600, by = 100)) > > How could i add a tittle on top of color index? > > Thank you > FirTry this Brazilan.Pallete <- colorRampPalette(c("green","yellow", "blue")) require(fields) image.plot(volcano, col = Brazilan.Pallete(50), legend.lab="Scale") contour(volcano, levels = seq(90, 200, by = 5), add = TRUE) -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil
Alain Guillet
2010-Feb-25 16:15 UTC
[R] How to extract one of four plots in a linear regression model
Hi, You can extract a plot in using the option which in specifying the number of the plot (from 1 to 6). For example: > plot(lm.D9, which=1) Regards, Alain Guillet On 25-Feb-10 16:50, FMH wrote:> Dear All, > > A linear regression model could be fitted by using lm function and the plot function can be used to check the assumption of the model. > > The help menu shows few instances on suitable coding for fitting such a linear model. In addition, four different plots could be extracted simultaneously with only a single plot function as followed: > > > > require(graphics) > ## Annette Dobson (1990) "An Introduction to Generalized Linear Models". > ## Page 9: Plant Weight Data. > ctl<- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) > trt<- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) > group<- gl(2,10,20, labels=c("Ctl","Trt")) > weight<- c(ctl, trt) > anova(lm.D9<- lm(weight ~ group)) > opar<- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(lm.D9, las = 1) > > > > > The plot function gives four different plots simulaneously but i just need only part of them, for instance the normality plot. Could someone give some ideas the way to extract this single plot as i need to copy only this plot and paste it into Word document. > > Thanks > Fir > > > > > > ______________________________________________ > 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. > >-- Alain Guillet Statistician and Computer Scientist SMCS - Institut de statistique - Universit? catholique de Louvain Bureau c.316 Voie du Roman Pays, 20 B-1348 Louvain-la-Neuve Belgium tel: +32 10 47 30 50