Here is one approach: > tmp <- > "p=0.05:A-B=3,C-D=10,D-E=100,A-F=2,AFR-E=3,ACE-D=1,ADEF-M=0,AED-E=10,DE-F=3,AB-J=4,AC-J=10,ED-F=1,ED-B=4,AF-B=10,CD-S=10,AM-C=4" > tmp2 <- gsub(',',', ',tmp) > tmp3 <- strwrap(tmp2, 30) > par(mar=c(5,4,10,1)+.1) > plot(1:10, main=paste(tmp3, collapse="\n"))
Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Hua Li > Sent: Tuesday, June 10, 2008 10:08 AM > To: r-help@r-project.org > Subject: [R] the title is too long for a graph > > Hi All, > > I have a problem of putting long titles on a graph: > > for example, > > x= seq(1:100) > y=seq(1:100) > plot(x,y,main="p=0.05:A-B=3,C-D=10,D-E=100,A-F=2,AFR-E=3,ACE-D > =1,ADEF-M=0,AED-E=10,DE-F=3,AB-J=4,AC-J=10,ED-F=1,ED-B=4,AF-B= > 10,CD-S=10,AM-C=4") > > R seems not able to print the whole title. The title content > might be changing and thus I don't know how long it is > beforehand. Is there a way to measure the length and then put > the title into different lines accordingly? > > Thanks! > > Hua > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.