Skip to content
Prev 178262 / 398506 Next

font size relative to graphic

On Apr 24, 2009, at 4:10 PM, Mike Miller wrote:

            
They do not correspond to inches, but the the numeric scale of the  
values. Here is your plot with the numbers moved so they are to the  
right of the bar ends:

txt <- "1.5  4.5  7.5 10.5 13.5 16.5 19.5 22.5 25.5  28.5  31.5  34.5
  2.5  5.5  8.5 11.5 14.5 17.5 20.5 23.5 26.5  29.5  32.5  35.5"
x <- read.table(textConnection(txt), header=FALSE)

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

# the rounding is what makes the dissimilar bars labeled with the same  
numbers, ... yecch.

Haven't figured out what the requirements on sizing really are;  but  
here is an example you might play with:

text(as.matrix(x+6), x.bar.plot-.07,  
as.character(as.matrix(round(x))), pos=2, col="black",
     cex= 24/length(as.matrix(x)))


David Winsemius, MD
Heritage Laboratories
West Hartford, CT