[R] Trouble with strwrap function

Aimee Jones alj27 at hoyamail.georgetown.edu
Mon Mar 5 01:49:51 CET 2012

Hi all,

I am formatting some graphs and adding text to them. When using the
strwrap function in the code below, it properly cuts the main title
into sizeable chunks and pastes the second line below that of the
first. The subtitle however, is all pasted on the same line, meaning
that it reads as gibberish in the graphical output. What can I do to
make sure the subtitle posts in consecutive lines (without using /n )?

thank you for your assistance,
Aimee Jones

plot(out_rk4$time, out_rk4$N2, col="blue", type="l", lwd=3,
cex.lab=0.75, xlim=c(0,3650), ylim=c(0,5000),xlab="Time(days)",
ylab="Numbers of Population", main=paste(strwrap("Total Cattle
population and Infected Aedes and Culex mosquitoes as a function of
time", width= 60)))
plot(out_rk4$time, out_rk4$I1, col="red", type="l", lwd=3,
xlim=c(0,3650), ylim=c(0,5000), xlab="", ylab="")
plot(out_rk4$time, out_rk4$I3, col="green", type="l", lwd=3,
xlim=c(0,3650), ylim=c(0,5000), xlab="", ylab="", cex.sub=0.5,
sub=paste(strwrap("The peaks in infected Aedes and Culex mosquitoes
correspond to a fall in cattle population due to a die-off. Infected
mosquito populations return to 0 when cattle population falls below a
critical level to maintain the virus in circulation. Births increase
the cattle population past this critical limit and once again, a mass
die-off of cattle and spike in infected mosquitoes occurs.", width
=360)) )

More information about the R-help mailing list