[R] Color barplots with a conditional?

Carlos Ortega
Thu, 15 Sep 2011 16:58:26 -0000

Hello,

There are some specific examples included in the help of barplot() that
answer your question.

Regards,
Carlos Ortega
www.qualityexcellence.es

On Wed, Sep 14, 2011 at 10:14 PM, Allie818 <alice.ly@gmail.com> wrote:

> I've made a barplot that has several bars. I'd like the bars to be
colored
> according to the type of category they are in. Is there a way to put a
> conditional into the color parameter in barplot?
> i.e. if data$category[i] == 1, color the bar red
>
> Do I need to generate the coloring sequence before the plot code first?
>
> Thanks!!
>
>
> --
> View this message in context:
>
http://r.789695.n4.nabble.com/Color-barplots-with-a-conditional-tp3813990p3813990.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]