Hi all,

I want to represent two categories with one color and have other categories
a different color on a bar plot.

I can do this using for one category/number using the ifelse call in col but
how to extend to two categories/numbers?

barplot(dataframe$vector_o_numbers, col=ifelse(dataframe$vector_o_numbers ==
00, "red", "black"), names.arg=dataframe$labels)

For example if I wanted to label 00 and 01 red and have the rest of the
categories colored black....how to do this?

Finally........I'd Iike to put a line on the bar plot representing an
expected number to compare to the observed number for a particular category.
In the past I've done this by drawing a line manually on a graph using
photoshop or something similar.  Is there way to do this in R?

Many thanks all in advance for your help!!

John

        [[alternative HTML version deleted]]

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

Reply via email to