On Mon, Apr 9, 2012 at 12:40 PM, Jason Rodriguez
<[email protected]> wrote:
> Hello, I have a graphics-related question:
>
> I was wondering if anyone knows of a way to create a bar chart that is
> colored with a three-part gradient that changes at fixed y-values. Each bar
> needs to fade green-to-yellow at Y=.10 and from yellow-to-red at Y=.20. Is
> there an option in a package somewhere that offers an easy way to do this?
?rainbow ?hsv
In R "an easy way" is an ill-defined term. In the absence of actual data:
bpd <- matrix(c(1,seq(0,1,l=64),2,1,seq(0,1,l=64),5,1,seq(0,1,l=64),7),nc=3)
mycols <- c('green',rainbow(64,start=0,end=.4)[64:1],'red')
barplot(bpd,col=mycols,border=NA)
"Easy" enough ?
Cheers
>
> Attached is a chart I macgyvered together in Excel using a combination of a
> simple bar chart, fit line, and some drawing tools. I want to avoid doing it
> this way in the future by finding a way to replicate it in R.
>
> Any ideas?
>
> Thanks,
>
> Jason Michael Rodriguez
> Data Analyst
> State Housing Trust Fund for the Homeless
> Georgia Department of Community Affairs
> Email: [email protected]
>
>
> ______________________________________________
> [email protected] 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.
>
______________________________________________
[email protected] 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.