This is a followup to a recent post on using atop() to obtain multiline expressions. My reading of the plotmath docs makes it clear that issuing (in base graphics) the specification par(cex = 2) doubles symbols and regular text in subsequent plotmath expressions. However, it is unclear to me what specifying cex _within_ the annotation function using plotmath should do, and the following seems to want to have it both ways: ignore/obey )or maybe recycle?) plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) text(1,1,labels=expression(atop(sigma,"some text")),cex = 2) ## obeys the cex specification in symbols and text HOWEVER plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) text(1,1,labels=expression(atop(atop(sigma,"some text"),"another level")),cex = 2) ## ??? For even more fun, try: plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) text(1,1,labels=expression(atop(atop(sigma,"some text"),"another level")),cex = 1:2) ##???? So I confess to being flummoxed. Enlightenment would be much appreciated. Cheers, Bert -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
Hi Bert, I think the 'cex=' argument applies to the outermost 'atop()'. It then applies that size specification to each of the two components of the atop(a,b). If one of the components is itself another atop(a,b), then the individual parts are sized downward to produce the required cex for the unit. As for the 'cex=1:2' specification, only the first value is used. Cheers, Peter Ehlers On 2012-05-12 14:05, Bert Gunter wrote:> This is a followup to a recent post on using atop() to obtain > multiline expressions. > > My reading of the plotmath docs makes it clear that issuing (in base > graphics) the specification > > par(cex = 2) > > doubles symbols and regular text in subsequent plotmath expressions. > However, it is unclear to me what specifying cex _within_ the > annotation function using plotmath should do, and the following seems > to want to have it both ways: ignore/obey )or maybe recycle?) > > plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) > text(1,1,labels=expression(atop(sigma,"some text")),cex = 2) > ## obeys the cex specification in symbols and text > > HOWEVER > > plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) > text(1,1,labels=expression(atop(atop(sigma,"some text"),"another > level")),cex = 2) > ## ??? > > For even more fun, try: > > plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) > text(1,1,labels=expression(atop(atop(sigma,"some text"),"another > level")),cex = 1:2) > ##???? > > So I confess to being flummoxed. Enlightenment would be much appreciated. > > Cheers, > Bert > > > >
Hello, It seems like a "feature". When trying the example below with more atops, the two bottom most lines, and only those two lines, feature character expansion relative to the default size and relative to the line before last. plot(1, type="n", xaxt='n', yaxt='n', ann=FALSE, xlim=c(-0.5, 6)) text(1, 1,labels=expression(atop(atop(sigma,"some text"), "another level")), cex = 2) text(3, 1, labels=expression(atop(atop(atop(sigma,"some text"), "another level"), "third")), cex = 2) text(5, 1, labels=expression(atop(atop(atop(atop(sigma,"some text"), "another level"), "third"), "4th")), cex = 2) Anyway, I couldn't find this behavior in the help pages. Rui Barradas Em 13-05-2012 11:00, Bert Gunter escreveu:> Date: Sat, 12 May 2012 14:05:26 -0700 > From: Bert Gunter<gunter.berton at gene.com> > To:r-help at r-project.org > Subject: [R] Plotmath bug or my misunderstanding? > Message-ID: > <CACk-te0syHj9XjbkfHPYtCMwyWtYdPFYCehxGpxidtBR0_PkdQ at mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > This is a followup to a recent post on using atop() to obtain > multiline expressions. > > My reading of the plotmath docs makes it clear that issuing (in base > graphics) the specification > > par(cex = 2) > > doubles symbols and regular text in subsequent plotmath expressions. > However, it is unclear to me what specifying cex_within_ the > annotation function using plotmath should do, and the following seems > to want to have it both ways: ignore/obey )or maybe recycle?) > > plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) > text(1,1,labels=expression(atop(sigma,"some text")),cex = 2) > ## obeys the cex specification in symbols and text > > HOWEVER > > plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) > text(1,1,labels=expression(atop(atop(sigma,"some text"),"another > level")),cex = 2) > ## ??? > > For even more fun, try: > > plot(1,type="n", xaxt='n', yaxt='n', ann=FALSE) > text(1,1,labels=expression(atop(atop(sigma,"some text"),"another > level")),cex = 1:2) > ##???? > > So I confess to being flummoxed. Enlightenment would be much appreciated. > > Cheers, > Bert