How to use color shade in Stacked bar plot?

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

How to use color shade in Stacked bar plot?

Manish Gupta
Hi,

I am wokring on stacked R plot but i want to use shade color of red for each stack and corresponding legend. How can i use it?

Regards
Reply | Threaded
Open this post in threaded view
|

Re: How to use color shade in Stacked bar plot?

Michael Weylandt
Far too vague a question but perhaps something like

barplot(1:12, col = c("brown1", "brown3", "brown2", "firebrick",
"firebrick1", "firebrick4",
"firebrick3", "firebrick2", "darkred", "red4", "red3"))

legend("topleft", col = c("brown1", "brown3", "brown2", "firebrick",
"firebrick1", "firebrick4",
"firebrick3", "firebrick2", "darkred", "red4", "red3"), legend = 1:12, pch = 15)

Michael

On Mon, Jul 23, 2012 at 11:34 AM, Manish Gupta
<[hidden email]> wrote:

> Hi,
>
> I am wokring on stacked R plot but i want to use shade color of red for each
> stack and corresponding legend. How can i use it?
>
> Regards
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-use-color-shade-in-Stacked-bar-plot-tp4637468.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [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: How to use color shade in Stacked bar plot?

Jim Lemon
In reply to this post by Manish Gupta
On 07/24/2012 02:34 AM, Manish Gupta wrote:
> Hi,
>
> I am wokring on stacked R plot but i want to use shade color of red for each
> stack and corresponding legend. How can i use it?
>
Hi Manish,
I think what you want is a series of reds that you can use to
distinguish the bars in a stack. The series will be repeated in each
stack of the plot. If this is the case, maybe this will help:

library(plotrix)
# assume you have five bars in each stack
# first use saturation - deep red to pink
myreds1<-color.scale(1:5,1,c(0,0.7),c(0,0.7))
# then try brightness - bright red to dark red
myreds2<-color.scale(1:5,c(1,0,5),0,0)
# finally use different red colors
myreds3<-color.scale(1:5,1,c(0,0.3),c(0.3,0))

Jim

______________________________________________
[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.