Malcolm Gillies
2000-Sep-18 11:32 UTC
[R] phantom(0) doesn't do what I expect it to [plotmath]
Hi, I'm trying to make a legend with a justified list of numbers, so I thought I would use phantom(0) to align the 3-digit numbers properly with the 4-digit ones: legend(x, y, xjust=1, yjust=1, lty=c(1,2,3,4,5), adj=c(0,0.5), legend=expression(phantom(0)*300*plain(K), phantom(0)*550*plain(K), phantom(0)*830*plain(K), 1440*plain(K), 2500*plain(K))) Unfortunately, phantom(0) doesn't seem to be adding any space, whether I use the X11 or the postscript device. Am I being obtuse? Should I file a PR? Suggestions for alternative solutions also appreciated (short of measuring all the string widths and building it up by hand ;-) cheers, Malcolm -- Malcolm Gillies <M.B.Gillies at pharm.uu.nl> PhD student, computational medicinal chemistry Dept of Medicinal Chemistry, Faculty of Pharmacy, Utrecht University, The Netherlands -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2000-Sep-18 12:05 UTC
[R] phantom(0) doesn't do what I expect it to [plotmath]
Malcolm Gillies <M.B.Gillies at pharm.uu.nl> writes:> Hi, > > I'm trying to make a legend with a justified list of numbers, so I > thought I would use phantom(0) to align the 3-digit numbers properly > with the 4-digit ones: > > legend(x, y, xjust=1, yjust=1, lty=c(1,2,3,4,5), adj=c(0,0.5), > legend=expression(phantom(0)*300*plain(K), > phantom(0)*550*plain(K), > phantom(0)*830*plain(K), > 1440*plain(K), > 2500*plain(K))) > > Unfortunately, phantom(0) doesn't seem to be adding any space, whether > I use the X11 or the postscript device. > > Am I being obtuse? Should I file a PR?No, yes. This looks like a bug, and even stuff advertised on the help page using phantom(0) doesn't seem to work. BTW : It's helpful if examples to reproduce a bug are directly executable. I.e. plot(1);legend(1,1,...etc...) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._