[R] labels inside the bars of horizontal barplot

From: Albert Vilella <avilella_at_gmail.com>
Date: Fri 17 Feb 2006 - 22:57:33 EST


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 Received on Fri Feb 17 23:03:56 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:34 EST