[R] Highlighting a few bars in a barplot

RINNER Heinrich HEINRICH.RINNER at tirol.gv.at
Thu Sep 9 16:55:06 CEST 2010


Hello Daniel,

something like that might work:

x <- runif(6)
marker1 <- rep(c("red", "blue"), 3)
marker2 <- c(rep(0,5), 10)
barplot(x, col = marker1)
barplot(x, density = marker2, add=T)

But I'd be interested if you learn about other solutions...

-Heinrich.

> -----Ursprüngliche Nachricht-----
> Von: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] Im Auftrag von Daniel Brewer
> Gesendet: Donnerstag, 09. September 2010 16:03
> An: r-help at stat.math.ethz.ch
> Betreff: [R] Highlighting a few bars in a barplot
>
>
> Hello,
>
> I have a bar plot where I am already using colour to
> distinguish one set
> of samples from another.  I would also like to highlight a
> few of these
> bars as ones that should be looked at in detail.  I was thinking of
> using hatching, but I can't work out how or if you can have a
> background
> colour and hatching which is different between bars.  Any
> suggestions on
> how I should do this?
>
> Thanks
>
> Dan
>
> --
> **************************************************************
> Daniel Brewer, Ph.D.
>
> Institute of Cancer Research
> Molecular Carcinogenesis
> Email: daniel.brewer at icr.ac.uk
> **************************************************************
>
> The Institute of Cancer Research: Royal Cancer Hospital, a
> charitable Company Limited by Guarantee, Registered in
> England under Company No. 534147 with its Registered Office
> at 123 Old Brompton Road, London SW7 3RP.
>
> This e-mail message is confidential and for use by the
> a...{{dropped:2}}
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list