Thanks everyone!  You've been a big help.  I've only ever worked with a few
colors before, so this is something new!


On Mon, Dec 9, 2013 at 1:46 PM, David Carlson <dcarl...@tamu.edu> wrote:

> The full details on the col= argument can be found in the
> section titled "Color Specification" on the help page for par -
> ?par.
>
> Basically, col= accepts color names, hexadecimal RGB, or an
> integer designating a position on the current palette. You can
> get the current palette using
>
> > palette()
> [1] "black"   "red"     "green3"  "blue"    "cyan"    "magenta"
> "yellow"
> [8] "gray"
>
> Any of these will give you red
>
> col="red"
> col="#FF0000"
> col=2
>
> You can change the palette colors with the palette() function,
> but some graphics functions draw axes, text, etc assuming the
> first color in the palette is black so it may be better to
> create a vector of the colors you want, eg.
>
> mc <- colors()[c(552, 254, 26)]
>
> and then use
>
> col=mc[1]
>
> -------------------------------------
> David L Carlson
> Department of Anthropology
> Texas A&M University
> College Station, TX 77840-4352
>
> -----Original Message-----
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Katharine
> Miller
> Sent: Monday, December 9, 2013 4:12 PM
> To: r-help@r-project.org
> Subject: [R] Problem with R colors
>
> Hello,
>
> I am having difficulty obtaining the correct colors in my R
> charts.
>
> > colors()[c(552, 254, 26)]
> [1] "red"   "green" "blue"
>
> But, if I specify col=552 in my barplot, I get gray bars.
> Likewise,
> col=254 gives bright pink, and col=26 is a red-orange.   I get
> accurate
> results when I spell out the names, but I am making a pallet
> with 20- 30
> colors and it is a real pain to have to do that.  Can anyone
> help me figure
> out what I am doing wrong?
>
> Thanks
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to