Re: [R] labels inside the bars of horizontal barplot

From: Jacques VESLOT <jacques.veslot_at_cirad.fr>
Date: Fri 17 Feb 2006 - 23:09:39 EST

b <- barplot(t(as.matrix(mydf)),horiz=TRUE,beside=TRUE,space=c(-0.9,0.1)) text(myvect1, b[1,], mylabels, col="white", adj=1)

Albert Vilella a écrit :

>Dears,
>
>I would like to add labels inside the bars of a horizontal bar
>plot like this:
>
>mylabels = c(
> "long text goes here first",
> "long text goes here second",
> "long text goes here third",
> "long text goes here fourth",
> "long text goes here fourth",
> "long text goes here fifth",
> "long text goes here sixth",
> "long text goes here seventh",
> "long text goes here bla bla",
> "long text goes here and more"
>)
>myvect1 = c(0.25,0.21,0.20,0.22,0.20,0.22,0.20,0.22,0.20,0.22)
>myvect2 = c(0.13,0.08,0.09,0.11,0.13,0.08,0.09,0.11,0.13,0.08)
>mydf = data.frame(myvect1,myvect2) # Forgive this df<->matrix mess, I
>use the df for other stuff
>barplot(t(as.matrix(mydf)),
> horiz=TRUE,
> beside=TRUE,
> space=c(-0.9,0.1))
>
>What I would like is to have the labels inside the upper bar.
>
>Any ideas?
>
>Bests,
>
> Albert.
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Feb 17 23:31:24 2006

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 14:08:40 EST