I am printing numbers onto horizontal bars in a bar plots, but I am finding it difficult to make the number always the right size. If there are more bars, the bars get narrower and the font is too big. I also find that if I change the size of the graph, the bars will get wider or narrower and the font stays about the same size. The result depends on whether I view the graph in X11 or in postscript.

Is there a way to specify font size relative to bar width, or at least specify font size relative to graph coordinates?

Here's a bit of what I've been doing:

x.bar.plot <- barplot(as.matrix(x), horiz=TRUE, beside=TRUE, xlim=c(0,100), 
xlab="Score", las=1)
text(as.matrix(x), x.bar.plot-.07, as.character(as.matrix(round(x))), pos=2, 
col="black")

The "-.07" is something I added to make the numbers align well with the bars under one condition, but it doesn't always help.

Any tips would be greatly appreciated.  Thanks in advance.

Mike

--
Michael B. Miller, Ph.D.
Minnesota Center for Twin and Family Research
Department of Psychology
University of Minnesota

______________________________________________
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