Hi there, I hope to give a different offset for each label in a complex plot. However, the following code does not work. > plot(1:4) > text(c(1:4), letters[1:4], pos = c(4,3,2,1), offset=c(1,2,3,4)) it seems that text() only use the first element of c(1,2,3,4), i.e., 1. Is it possible to assign a different offset for each label? Any suggestions or comments will be really appreciated. Regards, Jinsong
On 29.03.2012 07:38, Jinsong Zhao wrote:> Hi there, > > I hope to give a different offset for each label in a complex plot. > However, the following code does not work. > > > plot(1:4) > > text(c(1:4), letters[1:4], pos = c(4,3,2,1), offset=c(1,2,3,4)) > > it seems that text() only use the first element of c(1,2,3,4), i.e., 1. > > Is it possible to assign a different offset for each label? > > Any suggestions or comments will be really appreciated.mapply(text, 1:4, 1:4, letters[1:4], pos = c(4,3,2,1), offset=c(1,2,3,4)) Uwe Ligges> Regards, > Jinsong > > ______________________________________________ > R-help at 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.
On 2012-03-30 5:34, Uwe Ligges wrote:> > > On 29.03.2012 07:38, Jinsong Zhao wrote: >> Hi there, >> >> I hope to give a different offset for each label in a complex plot. >> However, the following code does not work. >> >> > plot(1:4) >> > text(c(1:4), letters[1:4], pos = c(4,3,2,1), offset=c(1,2,3,4)) >> >> it seems that text() only use the first element of c(1,2,3,4), i.e., 1. >> >> Is it possible to assign a different offset for each label? >> >> Any suggestions or comments will be really appreciated. > > > mapply(text, 1:4, 1:4, letters[1:4], > pos = c(4,3,2,1), offset=c(1,2,3,4)) > > Uwe Ligges >Thanks a lot. It works like a charm. Regards Jinsong