hdr.den plot colors help

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

hdr.den plot colors help

Andras Farkas
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

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: hdr.den plot colors help

Rui Barradas
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
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: hdr.den plot colors help

Andras Farkas
Rui,

package is hdrcde, and thanks for the input,

Andras

--- On Fri, 6/21/13, Rui Barradas <[hidden email]> wrote:

> From: Rui Barradas <[hidden email]>
> Subject: Re: [R] hdr.den plot colors help
> To: "Andras Farkas" <[hidden email]>
> Cc: [hidden email]
> 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
> >
> > ______________________________________________
> > [hidden email]
> 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.
> >
>

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: hdr.den plot colors help

David Carlson
In reply to this post by Andras Farkas
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: [hidden email]
[mailto:[hidden email]] On Behalf Of Andras Farkas
Sent: Friday, June 21, 2013 10:08 AM
To: [hidden email]
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

______________________________________________
[hidden email] 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.

______________________________________________
[hidden email] 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.