1

I wish to include a subscript and a title running into two lines at the same time but am not getting desired result with following commands:

base<-'B1'
compare<-'A1'
plot (1, 1, main = bquote('Annual mean' ~CO[2] ~'Flux Difference: \n'  ~.(compare)~ 'minus'~.(base)))

I wish to insert a line break after 'Flux Difference' but its not happening instead this term is hanging nowhere. Please help me.

Thanks, Munish

plannapus
  • 18,529
  • 4
  • 72
  • 94
Munish
  • 667
  • 3
  • 13
  • 34
  • Please put the command on separate lines and a dput of the head of your data. – hd1 Nov 09 '12 at 23:21
  • @hd1: After you get some more cred you will be able to fix these newbie formatting lapses yourself. – IRTFM Nov 09 '12 at 23:31

1 Answers1

7

This is a fairly common request and there is no really clean answer. Plotmath will not accept a "\n" (and the help page documents this.) One dodge is to use each line as an argument to the plotmath function atop. The other plotmath trick sometimes of use is phantom with an empty argument list to allow the tilde not to throw an error, but that is not needed here:

plot (1, 1, main = bquote( atop('Annual mean' ~CO[2] ~'Flux Difference:' , 
                                     .(compare)~ 'minus'~.(base))) )

enter image description here

IRTFM
  • 258,963
  • 21
  • 364
  • 487