You should tell us where hdr.den() comes from as it is not one of
the default packages and there are thousands of packages. Some
searching suggests you are using package hdrcde.
Looking at the source code for hdr.den() it appears that the package
author used the default palette in selecting colors. You can't
change the colors directly, but you can change the palette.
> palette() # Default palette
[1] "black" "red" "green3" "blue"
"cyan" "magenta"
"yellow"
[8] "gray" > default.colors <- palette() # Save the default palette
> new.colors <- c("black", "dark gray", "light
gray", "black",
"cyan", "magenta",
"yellow")> palette(new.colors) # Change the palette
> hdr.den(a,prob = c(25, 50, 75,95))
> palette(default.colors) # Restore the default palette
You could also change the magenta and cyan colors the same way.
------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352
-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Andras Farkas
Sent: Friday, June 21, 2013 10:08 AM
To: r-help at r-project.org
Subject: [R] hdr.den plot colors help
Dear All,
I have the following code:
a <-rnorm(5000,10,2)
hdr.den(a,prob = c(25, 50, 75,95))
is there a way to change the colors of the horizontal bars
representing the given highest density regions from the current
white, green, red and black to colors of the shades of grey going
from lighter to darker?
appreciate the help,
thanks,
Andras
______________________________________________
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.