0
    m <- mean(outcome[, 11], na.rm = TRUE)

   hist(df[, 11], main = "",xlab="", ylab="", xlim = c(0,as.integer(range(df[,11], na.rm=TRUE))[-1]), axes = FALSE)
   axis(side = 1, at = c(10,15,20))
   axis(side = 2, at = c(0,200,400,600), labels=c(0,200,'',600),pos=c(as.integer(range(df[,23], na.rm=TRUE))[-2],0))
   mtext(expression(paste(plain("My Title("), hat(X)== substitute(m) , plain(")"))), side=3, line= 2, cex = 1, at=14)

how to use value of m in mtext?

This link here suggests two ways which works with text() but not in mtext().

Community
  • 1
  • 1

1 Answers1

1

I think line=2 makes it get printed off the edge of the plot region. Try using bquote instead of paste():

 mtext(bquote( plain("My Title(")* hat(X) == .(m) * plain(")")), 
       side=3,  cex = 1, at=14)

When you drop the paste() strategy you need to use tildes (space) and asterisks (no-space) to connect the components.

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • Thanks works even with line=2 `code: mtext(bquote(plain("My Title(")* hat(X) == .(m) * plain(")")), side=3, line= 2, cex = 1, at=14)` – user882096 Oct 10 '13 at 10:25