Thank very much for this very cool help! Joh
Greg Snow wrote: > There is also the spread.labs function in the TeachingDemos package that > uses a different method from the plotrix function and should not move any > labels that are not overlapping. There are also the dynIdentify and > TkIdentify functions in the same package that allow you to interactively > move labels around to where you are happy with their positions, then > returns the coordinates to use for the positions in a final version of the > plot. > > If you want to check by hand, you can use the strheight and strwidth > functions to find the bounding rectangles and see if they overlap (there > can be some cases where the actual text does not overlap even if the > rectangles do). > > 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] >> project.org] On Behalf Of Johannes Graumann >> Sent: Tuesday, October 28, 2008 8:42 AM >> To: [EMAIL PROTECTED] >> Subject: [R] Best way of figuring out whether graphical elements >> overlap? >> >> Hi all, >> >> I'm plotting impulses, where some of them should have labels hovering >> above them. I know of plotrix' spread.labels function, but would like >> to save that for instances where there truely is to little space for >> the label. >> Does anybody have any hints what' the most efficient way might be to >> achieve the following: >> - plot an impulse plot >> - before placing each of a vector of text labels, check (using >> strhight/width), whether this collides graphically with anything >> already plotted and only plot it if not. >> >> Thanks for any hints, Joh >> >> ______________________________________________ >> 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. ______________________________________________ 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.