Thank you Marc,

The typo was causing the problem, solved now.

Regards,
Fipou

On Mon, Jul 18, 2016 at 8:38 PM, Marc Schwartz <marc_schwa...@me.com> wrote:

>
> > On Jul 18, 2016, at 1:06 PM, Abdoulaye Sarr <abdoulaye...@gmail.com>
> wrote:
> >
> > I am doing a basic bar plot which works but the color of bars positive
> > (green) and negative (brown) don’t show up from the below command:
> >
> > barplot(z, ylim=c(-2,2), col=ifelse(x>0,"brown","green »))
> >
> > any help? or other methods?
> >
> > fipou
>
>
> Presuming that the above is a direct copy and paste, your ifelse()
> statement is using 'x' to determine the color, rather than 'z'. Presumably
> a typo?
>
> This works, for example, with 'z' as a vector:
>
>   z <- seq(from = -5, to = 5)
>
>   barplot(z, col = ifelse(z > 0, "brown", "green"))
>
>
> Regards,
>
> Marc Schwartz
>
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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