Re: [R] Highliting a text in a plot
How about this: hilight - function(x,y,s, bg=yellow) { text.width - strwidth(s) text.height - strheight(s) rect(x,y,x+text.width,y+text.height,col=bg,border=NA) text(x,y,s,adj=c(0,0)) } plot(1:10,1:10,type=b) hilight(4,4,Point) On 23/06/07, Maja Schröter [EMAIL PROTECTED] wrote: Hi everyone, I want to highlight something in a plot. So I want to write a text with a yellow background. I tried to make use of text(x,y,hallo,bg=yellow) but that does not work. I know I am a handful. Sorry! Maja! -- __ R-help@stat.math.ethz.ch 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. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch 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] Highliting a text in a plot
Hi everyone, I want to highlight something in a plot. So I want to write a text with a yellow background. I tried to make use of text(x,y,hallo,bg=yellow) but that does not work. I know I am a handful. Sorry! Maja! -- __ R-help@stat.math.ethz.ch 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.
Re: [R] Highliting a text in a plot
Maja: This will work. It's quick. It's easy. And it probably isn't what you want because there is room for an unplotted symbol on the left. But it might suffice. plot(NA, xlim=0:1, ylim=0:1)## legend(x=0.5, y = 0.5, hallo, bg=yellow, col=dark blue, box.lty=0) You can look at the code for legend (?legend) and modify it, or use parts of it for your own function. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Maja Schröter Sent: Saturday, June 23, 2007 4:55 PM To: r-help@stat.math.ethz.ch Subject: [R] Highliting a text in a plot Hi everyone, I want to highlight something in a plot. So I want to write a text with a yellow background. I tried to make use of text(x,y,hallo,bg=yellow) but that does not work. I know I am a handful. Sorry! Maja! -- __ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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.