Re: [R] Highliting a text in a plot

From: David Barron <mothsailor_at_googlemail.com>
Date: Sun, 24 Jun 2007 09:35:47 +0100

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" <maja.schroeter_at_gmx.de> 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_at_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_at_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.
Received on Sun 24 Jun 2007 - 08:40:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 24 Jun 2007 - 09:32:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.