After trying to find if there was a color picker in the FAQs and the help, I thought I would send a post here. I was overwhelmed with all the wonderful color choices R has predefined (discovered after typing in colors()) but can't figure out what they all (by name) look like. Is there a color picker or some other method to display all those colors next to the name? I think I can put together palettes, but another question I have then regards the building of palettes (a list of variable length I can select or create myself other than the ones defined by Palette) so I can pass these colors into functions instead of having to predefine a bunch of colors myself or use the predefined colors like terrain.colors(n)? Are there groups of colors in the colors() that I can group together to make some nice palettes for drawing barplots, etc? Thanks, Jeff. -- Jeff D. Hamann Forest Informatics, Inc. PO Box 1421 Corvallis, Oregon 97339-1421 phone 541-754-1428 fax 541-752-0288 jeff.hamann at forestinformatics.com www.forestinformatics.com
Colors predefined in R follow closely colors predefined in in HTML language. See: http://users.rcn.com/giant.interport/COLOR/1ColorSpecifier.html http://www.brobstsystems.com/colors1.htm http://www.geocities.com/html4kids/colors.htm And probably countless other websites defining them. Jarek ====================================================\====== Jarek Tuszynski, PhD. o / \ Science Applications International Corporation <\__,| (703) 676-4192 "> \ Jaroslaw.W.Tuszynski at saic.com ` \ -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jeff D. Hamann Sent: Monday, May 23, 2005 11:35 AM To: r-help at stat.math.ethz.ch Subject: [R] colors and palettes and things... After trying to find if there was a color picker in the FAQs and the help, I thought I would send a post here. I was overwhelmed with all the wonderful color choices R has predefined (discovered after typing in colors()) but can't figure out what they all (by name) look like. Is there a color picker or some other method to display all those colors next to the name? I think I can put together palettes, but another question I have then regards the building of palettes (a list of variable length I can select or create myself other than the ones defined by Palette) so I can pass these colors into functions instead of having to predefine a bunch of colors myself or use the predefined colors like terrain.colors(n)? Are there groups of colors in the colors() that I can group together to make some nice palettes for drawing barplots, etc? Thanks, Jeff. -- Jeff D. Hamann Forest Informatics, Inc. PO Box 1421 Corvallis, Oregon 97339-1421 phone 541-754-1428 fax 541-752-0288 jeff.hamann at forestinformatics.com www.forestinformatics.com ______________________________________________ R-help at 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
1. I faced the same issue and came up with the code below.
2. See rainbow().
allcol <- colors()
png("Rcolors.png",width=1100,height=3000)
par(mai=c(0.4,0.5,0.3,0.2),omi=c(0.2,0,0,0),cex.axis=0.1,pch=15,bg="white")
plot(1,1,xlim=c(1,10),ylim=c(1,66),col=allcol[1],cex=4)
axis(1,at=NULL,labels=FALSE,tick=FALSE)
clr <- 1
for (i in 66:1) for (j in 10:1) {
if (clr > length(allcol)) break
points(j,i,col=allcol[clr],cex=4)
text(j,i,allcol[clr],cex=0.8,pos=1)
clr <- clr + 1
}
dev.off()
-----Original Message-----
From: Jeff D. Hamann [mailto:jeff.hamann at forestinformatics.com]
Sent: Monday, May 23, 2005 11:35 AM
To: r-help at stat.math.ethz.ch
Subject: [R] colors and palettes and things...
After trying to find if there was a color picker in the FAQs and the help,
I thought I would send a post here. I was overwhelmed with all the
wonderful color choices R has predefined (discovered after typing in
colors()) but can't figure out what they all (by name) look like. Is there
a color picker or some other method to display all those colors next to
the name?
I think I can put together palettes, but another question I have then
regards the building of palettes (a list of variable length I can select
or create myself other than the ones defined by Palette) so I can pass
these colors into functions instead of having to predefine a bunch of
colors myself or use the predefined colors like terrain.colors(n)?
Are there groups of colors in the colors() that I can group together to
make some nice palettes for drawing barplots, etc?
Thanks,
Jeff.
--
Jeff D. Hamann
Forest Informatics, Inc.
PO Box 1421
Corvallis, Oregon 97339-1421
phone 541-754-1428
fax 541-752-0288
jeff.hamann at forestinformatics.com
www.forestinformatics.com
______________________________________________
R-help at 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
Dear Jeff, Some time ago, Don McQueen posted to r-help a nice function for displaying the named colours. You'll find it at <http://finzi.psych.upenn.edu/R/Rhelp02a/archive/31607.html>. As well, if you're using R for Windows, the various named colours are defined in the file rgb.txt in R's etc directory. I hope this helps, John -------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox --------------------------------> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jeff D. Hamann > Sent: Monday, May 23, 2005 10:35 AM > To: r-help at stat.math.ethz.ch > Subject: [R] colors and palettes and things... > > After trying to find if there was a color picker in the FAQs > and the help, I thought I would send a post here. I was > overwhelmed with all the wonderful color choices R has > predefined (discovered after typing in > colors()) but can't figure out what they all (by name) look > like. Is there a color picker or some other method to display > all those colors next to the name? > > I think I can put together palettes, but another question I > have then regards the building of palettes (a list of > variable length I can select or create myself other than the > ones defined by Palette) so I can pass these colors into > functions instead of having to predefine a bunch of colors > myself or use the predefined colors like terrain.colors(n)? > > Are there groups of colors in the colors() that I can group > together to make some nice palettes for drawing barplots, etc? > > Thanks, > Jeff. > > > -- > Jeff D. Hamann > Forest Informatics, Inc. > PO Box 1421 > Corvallis, Oregon 97339-1421 > phone 541-754-1428 > fax 541-752-0288 > jeff.hamann at forestinformatics.com > www.forestinformatics.com > > ______________________________________________ > R-help at 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
"Jeff D. Hamann" <jeff.hamann at forestinformatics.com> wrote in message news:2088.128.193.139.69.1116862527.squirrel at www.forestinformatics.com...> After trying to find if there was a color picker in the FAQs and the help, > I thought I would send a post here. I was overwhelmed with all the > wonderful color choices R has predefined (discovered after typing in > colors()) but can't figure out what they all (by name) look like. Is there > a color picker or some other method to display all those colors next to > the name?Perhaps this PDF with a "Chart of R Colors" will help: http://research.stowers-institute.org/efg/R/Color/Chart/ColorChart.pdf R details are on this page about color and also show how to create the above PDF: http://research.stowers-institute.org/efg/R/Color/Chart/index.htm efg
Jeff D. Hamann wrote:> After trying to find if there was a color picker in the FAQs and the help, > I thought I would send a post here. I was overwhelmed with all the > wonderful color choices R has predefined (discovered after typing in > colors()) but can't figure out what they all (by name) look like. Is there > a color picker or some other method to display all those colors next to > the name? > > I think I can put together palettes, but another question I have then > regards the building of palettes (a list of variable length I can select > or create myself other than the ones defined by Palette) so I can pass > these colors into functions instead of having to predefine a bunch of > colors myself or use the predefined colors like terrain.colors(n)? > > Are there groups of colors in the colors() that I can group together to > make some nice palettes for drawing barplots, etc? > > Thanks, > Jeff. > >I'd like to point out some packages or code snippets that might be useful for you: # base package "grDevices": ?colorRamp example(colorRamp) # CRAN package "colorspace": library(help = colorspace) # CRAN package "RColorBrewer": library(RColorBrewer) ?brewer.pal example(brewer.pal) # see also the last two examples by Martin Maechler in # CRAN package scatterplot3d: library(scatterplot3d) ?scatterplot3d example(scatterplot3d) Uwe Ligges
The DAAG package has the following:
show.colors(type=c("singles", "shades",
"grayshades"),
order.cols=TRUE)
I am sure there are better ways to do the ordering than my ad hoc
approach,
though.
John Maindonald email: john.maindonald at anu.edu.au
phone : +61 2 (6125)3473 fax : +61 2(6125)5549
Centre for Bioinformation Science, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.
On 24 May 2005, at 11:04 AM, r-help-request at stat.math.ethz.ch wrote:
> From: "Jeff D. Hamann" <jeff.hamann at
forestinformatics.com>
> Date: 23 May 2005 4:35:27 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] colors and palettes and things...
> Reply-To: jeff.hamann at forestinformatics.com
>
>
> After trying to find if there was a color picker in the FAQs and the
> help,
> I thought I would send a post here. I was overwhelmed with all the
> wonderful color choices R has predefined (discovered after typing in
> colors()) but can't figure out what they all (by name) look like. Is
> there
> a color picker or some other method to display all those colors next to
> the name?
>
> I think I can put together palettes, but another question I have then
> regards the building of palettes (a list of variable length I can
> select
> or create myself other than the ones defined by Palette) so I can pass
> these colors into functions instead of having to predefine a bunch of
> colors myself or use the predefined colors like terrain.colors(n)?
>
> Are there groups of colors in the colors() that I can group together to
> make some nice palettes for drawing barplots, etc?
>
> Thanks,
> Jeff.
>
>
> --
> Jeff D. Hamann
> Forest Informatics, Inc.
> PO Box 1421
> Corvallis, Oregon 97339-1421
> phone 541-754-1428
> fax 541-752-0288
> jeff.hamann at forestinformatics.com
> www.forestinformatics.com