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
hdr.den plot colors help
4 messages · Rui Barradas, Andras Farkas, David L Carlson
Hello, It's not your first post, you should know to say from which package is the function you're using. As for the question the answer is no, those values are hard coded in the source. What you can do is to download the source and change file hdr.den.R Hope this helps, Rui Barradas Em 21-06-2013 16:07, Andras Farkas escreveu:
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.
Rui, package is hdrcde, and thanks for the input, Andras
--- On Fri, 6/21/13, Rui Barradas <ruipbarradas at sapo.pt> wrote:
From: Rui Barradas <ruipbarradas at sapo.pt> Subject: Re: [R] hdr.den plot colors help To: "Andras Farkas" <motyocska at yahoo.com> Cc: r-help at r-project.org Date: Friday, June 21, 2013, 11:51 AM Hello, It's not your first post, you should know to say from which package is the function you're using. As for the question the answer is no, those values are hard coded in the source. What you can do is to download the source and change file hdr.den.R Hope this helps, Rui Barradas Em 21-06-2013 16:07, Andras Farkas escreveu:
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.
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.