Re: [R] 2d plotting and colours
And does this work? n - 5 par(mfrow = c(2,2)) palette(default) barplot(1:25,col = 1:25) pal - rainbow(n) barplot(1:25,col = pal[(1:25-1)%%n+1]) pal - rgb((0:15)/15, g=0,b=0, names=paste(red,0:15,sep=.)) barplot(1:25,col = pal[(1:25-1)%%n+1]) Earl F. Glynn wrote: Mulholland, Tom [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Since I was only concentrating on colour issues and not on your specific problem I was just showing the possibilities. Does this code help n - 5 par(mfrow = c(2,2)) palette(default) barplot(1:25,col = 1:25) palette(rainbow(n)) barplot(1:25,col = 1:25) palette(rgb((0:15)/15, g=0,b=0, names=paste(red,0:15,sep=.))) barplot(1:25,col = 1:25) require(cluster) x - runif(100) * 8 + 2 cl - kmeans(x, n) palette(rainbow(n)) plot(x, col = cl$cluster) abline(h = cl$centers, lty = 2,col = grey ) palette(palette()[order(cl$centers)]) points(x,col = cl$cluster,pch = 20,cex = 0.4) Using Windows with R 2.0.1 this looks fine at first. But when I resize the graphic, copy the graphic to a metafile and paste it into Word, or go to an earlier graphic and come back using History, the colors ae all messed up. It's as if only the last palette is being used for all four plots in the figure. Oddly, if I copy the graphic as a bitmap, the colors are preseved in the bitmap. Is this a quirk of my machine or does this happen for others? Is it possible that the Windows palette manager is being used (which is such about obsolete) and that true color graphics are not being used (which is the easist way to avoid headaches from the Windows palette manager)? efg __ 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-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
Re: [R] 2d plotting and colours
Mulholland, Tom [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Since I was only concentrating on colour issues and not on your specific problem I was just showing the possibilities. Does this code help n - 5 par(mfrow = c(2,2)) palette(default) barplot(1:25,col = 1:25) palette(rainbow(n)) barplot(1:25,col = 1:25) palette(rgb((0:15)/15, g=0,b=0, names=paste(red,0:15,sep=.))) barplot(1:25,col = 1:25) require(cluster) x - runif(100) * 8 + 2 cl - kmeans(x, n) palette(rainbow(n)) plot(x, col = cl$cluster) abline(h = cl$centers, lty = 2,col = grey ) palette(palette()[order(cl$centers)]) points(x,col = cl$cluster,pch = 20,cex = 0.4) Using Windows with R 2.0.1 this looks fine at first. But when I resize the graphic, copy the graphic to a metafile and paste it into Word, or go to an earlier graphic and come back using History, the colors ae all messed up. It's as if only the last palette is being used for all four plots in the figure. Oddly, if I copy the graphic as a bitmap, the colors are preseved in the bitmap. Is this a quirk of my machine or does this happen for others? Is it possible that the Windows palette manager is being used (which is such about obsolete) and that true color graphics are not being used (which is the easist way to avoid headaches from the Windows palette manager)? efg __ 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
Re: [R] 2d plotting and colours
Hi Earl F. Glynn wrote: Mulholland, Tom [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Since I was only concentrating on colour issues and not on your specific problem I was just showing the possibilities. Does this code help n - 5 par(mfrow = c(2,2)) palette(default) barplot(1:25,col = 1:25) palette(rainbow(n)) barplot(1:25,col = 1:25) palette(rgb((0:15)/15, g=0,b=0, names=paste(red,0:15,sep=.))) barplot(1:25,col = 1:25) require(cluster) x - runif(100) * 8 + 2 cl - kmeans(x, n) palette(rainbow(n)) plot(x, col = cl$cluster) abline(h = cl$centers, lty = 2,col = grey ) palette(palette()[order(cl$centers)]) points(x,col = cl$cluster,pch = 20,cex = 0.4) Using Windows with R 2.0.1 this looks fine at first. But when I resize the graphic, copy the graphic to a metafile and paste it into Word, or go to an earlier graphic and come back using History, the colors ae all messed up. It's as if only the last palette is being used for all four plots in the figure. Oddly, if I copy the graphic as a bitmap, the colors are preseved in the bitmap. Is this a quirk of my machine or does this happen for others? Is it possible that the Windows palette manager is being used (which is such about obsolete) and that true color graphics are not being used (which is the easist way to avoid headaches from the Windows palette manager)? I think this is happening because the setting of the R graphics palette is not being recorded on the R graphics display list. Any window refresh will produce the effect. Even worse, the R graphics palette is global to the R session, not per-device, so simply recording the setting of the palette on the (per-device) display list would only create a more subtle undesirable effect. A possible solution is to make a per-device palette (and record the setting of the palette on the display list), but this is probably too big a change to get done for 2.1.0. A workaround is simply to avoid using the palette. For example, n - 5 par(mfrow = c(2,2)) palette(default) barplot(1:25,col = 1:25) barplot(1:25,col = rainbow(n)) cols - rgb((0:15)/15, g=0,b=0, names=paste(red,0:15,sep=.)) barplot(1:25,col = cols) Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ 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
RE: [R] 2d plotting and colours
Since I was only concentrating on colour issues and not on your specific problem I was just showing the possibilities. Does this code help n - 5 par(mfrow = c(2,2)) palette(default) barplot(1:25,col = 1:25) palette(rainbow(n)) barplot(1:25,col = 1:25) palette(rgb((0:15)/15, g=0,b=0, names=paste(red,0:15,sep=.))) barplot(1:25,col = 1:25) require(cluster) x - runif(100) * 8 + 2 cl - kmeans(x, n) palette(rainbow(n)) plot(x, col = cl$cluster) abline(h = cl$centers, lty = 2,col = grey ) palette(palette()[order(cl$centers)]) points(x,col = cl$cluster,pch = 20,cex = 0.4) However you may wish to choose your colours in a way that is different from cl$cluster which is why I changed the palette before plotting the points. You should see that they now are ordered from bottom to top of the last plot. You could also choose to create a vector with your colours and then use the value in cl$cluster to select the colours mycols - rainbow(n) plot(x,col = mycols[cl$cluster]) Tom -Original Message- From: Asha Jayanthi [mailto:[EMAIL PROTECTED] Sent: Thursday, 31 March 2005 9:17 AM To: r-help@stat.math.ethz.ch Subject: RE: [R] 2d plotting and colours Thank you very much. the code plot(x, col = s) points(cl$centers, col = s, pch = 8, cex=2) does not plot the points according to the group colors. The plots are used to identify the groups by colors That could be done by plot(x, col = cl$cluster) This means that we need to set the default colours , say col = cl$cluster = a set of group numbers say 1...10 should produce 10 distinct colours points grouped by colour. how to do this when you have more than 8 group colours to plot From: Mulholland, Tom [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch,Asha Jayanthi [EMAIL PROTECTED] Subject: RE: [R] 2d plotting and colours Date: Wed, 30 Mar 2005 15:59:46 +0800 And getting back to your question about the palette there are a lot of ways to do this assuming you have just started a session palette() # will give #[1] black red green3 bluecyan #[6] magenta yellow gray palette(rainbow(24)) # There's also 'heat.colors' 'topo.colors' palette() # [1] red #FF4000 #FF8000 # [4] #FFBF00 yellow #BFFF00 # [7] #80FF00 #40FF00 green #[10] #00FF40 #00FF80 #00FFBF #[13] cyandeepskyblue #0080FF #[16] #0040FF blue#4000FF #[19] #8000FF #BF00FF magenta #[22] #FF00BF #FF0080 #FF0040 palette(rgb((0:15)/15, g=0,b=0, names=paste(red,0:15,sep=.))) palette() # [1] black #11 #22 #33 #44 # [6] #55 #66 #77 #88 #99 #[11] #AA #BB #CC #DD red2 #[16] red If you are looking to use colours that take account of colour blindness you could try the package dichromat. (I think 2.1 will have some of this inbuilt) Once you look through the help files associated with some of these options you will find the way that best suits your method of working. Tom -Original Message- From: Uwe Ligges [mailto:[EMAIL PROTECTED] Sent: Wednesday, 30 March 2005 3:18 PM To: TEMPL Matthias Cc: r-help@stat.math.ethz.ch; Asha Jayanthi Subject: Re: [R] 2d plotting and colours TEMPL Matthias wrote: Hi! There are more than 8 colors. Yes, e.g. for rgb space there are 16777216, see ?rgb. Uwe Ligges x - rbind(matrix(rnorm(100, sd = 0.3), ncol = 2), matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2)) (cl - kmeans(x, i, 20)) s - c(tomato4, turquoise, slateblue, wheat, snow, skyblue, peru, pink) # see at: colors() plot(x, col = s) points(cl$centers, col = s, pch = 8, cex=2) Best, Matthias Hi! I am new to R just 3 days in it and i apologize if my questions seem very trivial and consumed your valuable time. I am coding in perl and i stumbled upon R regarding plotting good statistical graphs. I tried the kmean clustering for a large matrix ,say 150 * 150 . I tried the example code given in the tutorial to perform 2d plot # i ranges from 2 to 10 cl - kmeans(x, i, 20) plot(x, col = cl$cluster) points(cl$centers, col = 1:i ) I see that there are only 8 colours defined , namely black,red,green,blue,cyan,magenta,yello,gray. How should i set my colour preferences to obtain my palette of colours? I checked in the totorial which talks about R.colors and palatte , but i failed to understand how to set it. Thank You Asha MSN Messenger! __ 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
RE: [R] 2d plotting and colours
Thank you. mycols - c(brown,orange,tomato) plot(x,col = mycols[cl$cluster]) this works. I can define distinct colours and check the graph. the rest of the examples does not give a wide palette to choose from Asha From: Mulholland, Tom [EMAIL PROTECTED] To: Asha Jayanthi [EMAIL PROTECTED],r-help@stat.math.ethz.ch Subject: RE: [R] 2d plotting and colours Date: Thu, 31 Mar 2005 10:14:13 +0800 Since I was only concentrating on colour issues and not on your specific problem I was just showing the possibilities. Does this code help n - 5 par(mfrow = c(2,2)) palette(default) barplot(1:25,col = 1:25) palette(rainbow(n)) barplot(1:25,col = 1:25) palette(rgb((0:15)/15, g=0,b=0, names=paste(red,0:15,sep=.))) barplot(1:25,col = 1:25) require(cluster) x - runif(100) * 8 + 2 cl - kmeans(x, n) palette(rainbow(n)) plot(x, col = cl$cluster) abline(h = cl$centers, lty = 2,col = grey ) palette(palette()[order(cl$centers)]) points(x,col = cl$cluster,pch = 20,cex = 0.4) However you may wish to choose your colours in a way that is different from cl$cluster which is why I changed the palette before plotting the points. You should see that they now are ordered from bottom to top of the last plot. You could also choose to create a vector with your colours and then use the value in cl$cluster to select the colours mycols - rainbow(n) plot(x,col = mycols[cl$cluster]) Tom -Original Message- From: Asha Jayanthi [mailto:[EMAIL PROTECTED] Sent: Thursday, 31 March 2005 9:17 AM To: r-help@stat.math.ethz.ch Subject: RE: [R] 2d plotting and colours Thank you very much. the code plot(x, col = s) points(cl$centers, col = s, pch = 8, cex=2) does not plot the points according to the group colors. The plots are used to identify the groups by colors That could be done by plot(x, col = cl$cluster) This means that we need to set the default colours , say col = cl$cluster = a set of group numbers say 1...10 should produce 10 distinct colours points grouped by colour. how to do this when you have more than 8 group colours to plot From: Mulholland, Tom [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch,Asha Jayanthi [EMAIL PROTECTED] Subject: RE: [R] 2d plotting and colours Date: Wed, 30 Mar 2005 15:59:46 +0800 And getting back to your question about the palette there are a lot of ways to do this assuming you have just started a session palette() # will give #[1] black red green3 bluecyan #[6] magenta yellow gray palette(rainbow(24)) # There's also 'heat.colors' 'topo.colors' palette() # [1] red #FF4000 #FF8000 # [4] #FFBF00 yellow #BFFF00 # [7] #80FF00 #40FF00 green #[10] #00FF40 #00FF80 #00FFBF #[13] cyandeepskyblue #0080FF #[16] #0040FF blue#4000FF #[19] #8000FF #BF00FF magenta #[22] #FF00BF #FF0080 #FF0040 palette(rgb((0:15)/15, g=0,b=0, names=paste(red,0:15,sep=.))) palette() # [1] black #11 #22 #33 #44 # [6] #55 #66 #77 #88 #99 #[11] #AA #BB #CC #DD red2 #[16] red If you are looking to use colours that take account of colour blindness you could try the package dichromat. (I think 2.1 will have some of this inbuilt) Once you look through the help files associated with some of these options you will find the way that best suits your method of working. Tom -Original Message- From: Uwe Ligges [mailto:[EMAIL PROTECTED] Sent: Wednesday, 30 March 2005 3:18 PM To: TEMPL Matthias Cc: r-help@stat.math.ethz.ch; Asha Jayanthi Subject: Re: [R] 2d plotting and colours TEMPL Matthias wrote: Hi! There are more than 8 colors. Yes, e.g. for rgb space there are 16777216, see ?rgb. Uwe Ligges x - rbind(matrix(rnorm(100, sd = 0.3), ncol = 2), matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2)) (cl - kmeans(x, i, 20)) s - c(tomato4, turquoise, slateblue, wheat, snow, skyblue, peru, pink) # see at: colors() plot(x, col = s) points(cl$centers, col = s, pch = 8, cex=2) Best, Matthias Hi! I am new to R just 3 days in it and i apologize if my questions seem very trivial and consumed your valuable time. I am coding in perl and i stumbled upon R regarding plotting good statistical graphs. I tried the kmean clustering for a large matrix ,say 150 * 150 . I tried the example code given in the tutorial to perform 2d plot # i ranges from 2 to 10 cl - kmeans(x, i, 20) plot(x, col = cl$cluster) points(cl$centers, col = 1:i ) I see that there are only 8 colours defined , namely black,red,green,blue,cyan,magenta,yello,gray. How should i set my colour preferences to obtain my palette of colours? I checked in the totorial which talks about R.colors and palatte , but i failed
RE: [R] 2d plotting and colours
I'm not sure that I understand you comment about the other examples not giving a wide palette. Are you using wide to refer to the difference in colours rather than the number of choices in the palette? If this is your issue you should look at the dichromat package that I referred to, in particular the colorRamp function. You might also want to have a look at the RColorBrewer package and run the ColorBrewer example. This package specifically deals with the ability to distinguish one colour from another.As the ColorBrewer website notes the tool is designed to help people select good color schemes for maps and other graphics. By the way if the mycols code works then palette(c(brown,orange,tomato)) plot(x,col = cl$cluster) should produce exactly the same result. Tom -Original Message- From: Asha Jayanthi [mailto:[EMAIL PROTECTED] Sent: Thursday, 31 March 2005 2:36 PM To: Mulholland, Tom; r-help@stat.math.ethz.ch Subject: RE: [R] 2d plotting and colours Thank you. mycols - c(brown,orange,tomato) plot(x,col = mycols[cl$cluster]) this works. I can define distinct colours and check the graph. the rest of the examples does not give a wide palette to choose from Asha From: Mulholland, Tom [EMAIL PROTECTED] To: Asha Jayanthi [EMAIL PROTECTED],r-help@stat.math.ethz.ch Subject: RE: [R] 2d plotting and colours Date: Thu, 31 Mar 2005 10:14:13 +0800 Since I was only concentrating on colour issues and not on your specific problem I was just showing the possibilities. Does this code help n - 5 par(mfrow = c(2,2)) palette(default) barplot(1:25,col = 1:25) palette(rainbow(n)) barplot(1:25,col = 1:25) palette(rgb((0:15)/15, g=0,b=0, names=paste(red,0:15,sep=.))) barplot(1:25,col = 1:25) require(cluster) x - runif(100) * 8 + 2 cl - kmeans(x, n) palette(rainbow(n)) plot(x, col = cl$cluster) abline(h = cl$centers, lty = 2,col = grey ) palette(palette()[order(cl$centers)]) points(x,col = cl$cluster,pch = 20,cex = 0.4) However you may wish to choose your colours in a way that is different from cl$cluster which is why I changed the palette before plotting the points. You should see that they now are ordered from bottom to top of the last plot. You could also choose to create a vector with your colours and then use the value in cl$cluster to select the colours mycols - rainbow(n) plot(x,col = mycols[cl$cluster]) Tom -Original Message- From: Asha Jayanthi [mailto:[EMAIL PROTECTED] Sent: Thursday, 31 March 2005 9:17 AM To: r-help@stat.math.ethz.ch Subject: RE: [R] 2d plotting and colours Thank you very much. the code plot(x, col = s) points(cl$centers, col = s, pch = 8, cex=2) does not plot the points according to the group colors. The plots are used to identify the groups by colors That could be done by plot(x, col = cl$cluster) This means that we need to set the default colours , say col = cl$cluster = a set of group numbers say 1...10 should produce 10 distinct colours points grouped by colour. how to do this when you have more than 8 group colours to plot From: Mulholland, Tom [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch,Asha Jayanthi [EMAIL PROTECTED] Subject: RE: [R] 2d plotting and colours Date: Wed, 30 Mar 2005 15:59:46 +0800 And getting back to your question about the palette there are a lot of ways to do this assuming you have just started a session palette() # will give #[1] black red green3 bluecyan #[6] magenta yellow gray palette(rainbow(24)) # There's also 'heat.colors' 'topo.colors' palette() # [1] red #FF4000 #FF8000 # [4] #FFBF00 yellow #BFFF00 # [7] #80FF00 #40FF00 green #[10] #00FF40 #00FF80 #00FFBF #[13] cyandeepskyblue #0080FF #[16] #0040FF blue#4000FF #[19] #8000FF #BF00FF magenta #[22] #FF00BF #FF0080 #FF0040 palette(rgb((0:15)/15, g=0,b=0, names=paste(red,0:15,sep=.))) palette() # [1] black #11 #22 #33 #44 # [6] #55 #66 #77 #88 #99 #[11] #AA #BB #CC #DD red2 #[16] red If you are looking to use colours that take account of colour blindness you could try the package dichromat. (I think 2.1 will have some of this inbuilt) Once you look through the help files associated with some of these options you will find the way that best suits your method of working. Tom -Original Message- From: Uwe Ligges [mailto:[EMAIL PROTECTED] Sent: Wednesday, 30 March 2005 3:18 PM To: TEMPL Matthias Cc: r-help@stat.math.ethz.ch; Asha Jayanthi Subject: Re: [R] 2d plotting and colours TEMPL Matthias wrote: Hi! There are more than 8 colors
RE: [R] 2d plotting and colours
Thank you very much. the code plot(x, col = s) points(cl$centers, col = s, pch = 8, cex=2) does not plot the points according to the group colors. The plots are used to identify the groups by colors That could be done by plot(x, col = cl$cluster) This means that we need to set the default colours , say col = cl$cluster = a set of group numbers say 1...10 should produce 10 distinct colours points grouped by colour. how to do this when you have more than 8 group colours to plot From: Mulholland, Tom [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch,Asha Jayanthi [EMAIL PROTECTED] Subject: RE: [R] 2d plotting and colours Date: Wed, 30 Mar 2005 15:59:46 +0800 And getting back to your question about the palette there are a lot of ways to do this assuming you have just started a session palette() # will give #[1] black red green3 bluecyan #[6] magenta yellow gray palette(rainbow(24)) # There's also 'heat.colors' 'topo.colors' palette() # [1] red #FF4000 #FF8000 # [4] #FFBF00 yellow #BFFF00 # [7] #80FF00 #40FF00 green #[10] #00FF40 #00FF80 #00FFBF #[13] cyandeepskyblue #0080FF #[16] #0040FF blue#4000FF #[19] #8000FF #BF00FF magenta #[22] #FF00BF #FF0080 #FF0040 palette(rgb((0:15)/15, g=0,b=0, names=paste(red,0:15,sep=.))) palette() # [1] black #11 #22 #33 #44 # [6] #55 #66 #77 #88 #99 #[11] #AA #BB #CC #DD red2 #[16] red If you are looking to use colours that take account of colour blindness you could try the package dichromat. (I think 2.1 will have some of this inbuilt) Once you look through the help files associated with some of these options you will find the way that best suits your method of working. Tom -Original Message- From: Uwe Ligges [mailto:[EMAIL PROTECTED] Sent: Wednesday, 30 March 2005 3:18 PM To: TEMPL Matthias Cc: r-help@stat.math.ethz.ch; Asha Jayanthi Subject: Re: [R] 2d plotting and colours TEMPL Matthias wrote: Hi! There are more than 8 colors. Yes, e.g. for rgb space there are 16777216, see ?rgb. Uwe Ligges x - rbind(matrix(rnorm(100, sd = 0.3), ncol = 2), matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2)) (cl - kmeans(x, i, 20)) s - c(tomato4, turquoise, slateblue, wheat, snow, skyblue, peru, pink) # see at: colors() plot(x, col = s) points(cl$centers, col = s, pch = 8, cex=2) Best, Matthias Hi! I am new to R just 3 days in it and i apologize if my questions seem very trivial and consumed your valuable time. I am coding in perl and i stumbled upon R regarding plotting good statistical graphs. I tried the kmean clustering for a large matrix ,say 150 * 150 . I tried the example code given in the tutorial to perform 2d plot # i ranges from 2 to 10 cl - kmeans(x, i, 20) plot(x, col = cl$cluster) points(cl$centers, col = 1:i ) I see that there are only 8 colours defined , namely black,red,green,blue,cyan,magenta,yello,gray. How should i set my colour preferences to obtain my palette of colours? I checked in the totorial which talks about R.colors and palatte , but i failed to understand how to set it. Thank You Asha MSN Messenger! __ 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-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-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 Cinema! __ 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
Re: [R] 2d plotting and colours
Hi! There are more than 8 colors. x - rbind(matrix(rnorm(100, sd = 0.3), ncol = 2), matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2)) (cl - kmeans(x, i, 20)) s - c(tomato4, turquoise, slateblue, wheat, snow, skyblue, peru, pink) # see at: colors() plot(x, col = s) points(cl$centers, col = s, pch = 8, cex=2) Best, Matthias Hi! I am new to R just 3 days in it and i apologize if my questions seem very trivial and consumed your valuable time. I am coding in perl and i stumbled upon R regarding plotting good statistical graphs. I tried the kmean clustering for a large matrix ,say 150 * 150 . I tried the example code given in the tutorial to perform 2d plot # i ranges from 2 to 10 cl - kmeans(x, i, 20) plot(x, col = cl$cluster) points(cl$centers, col = 1:i ) I see that there are only 8 colours defined , namely black,red,green,blue,cyan,magenta,yello,gray. How should i set my colour preferences to obtain my palette of colours? I checked in the totorial which talks about R.colors and palatte , but i failed to understand how to set it. Thank You Asha MSN Messenger! __ 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-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
Re: [R] 2d plotting and colours
TEMPL Matthias wrote: Hi! There are more than 8 colors. Yes, e.g. for rgb space there are 16777216, see ?rgb. Uwe Ligges x - rbind(matrix(rnorm(100, sd = 0.3), ncol = 2), matrix(rnorm(100, mean = 1, sd = 0.3), ncol = 2)) (cl - kmeans(x, i, 20)) s - c(tomato4, turquoise, slateblue, wheat, snow, skyblue, peru, pink) # see at: colors() plot(x, col = s) points(cl$centers, col = s, pch = 8, cex=2) Best, Matthias Hi! I am new to R just 3 days in it and i apologize if my questions seem very trivial and consumed your valuable time. I am coding in perl and i stumbled upon R regarding plotting good statistical graphs. I tried the kmean clustering for a large matrix ,say 150 * 150 . I tried the example code given in the tutorial to perform 2d plot # i ranges from 2 to 10 cl - kmeans(x, i, 20) plot(x, col = cl$cluster) points(cl$centers, col = 1:i ) I see that there are only 8 colours defined , namely black,red,green,blue,cyan,magenta,yello,gray. How should i set my colour preferences to obtain my palette of colours? I checked in the totorial which talks about R.colors and palatte , but i failed to understand how to set it. Thank You Asha MSN Messenger! __ 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-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-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