[R] R implementations of scatterplot/map labeling algorithims?

Chuck Cleland ccleland at optonline.net
Fri Feb 16 17:56:59 CET 2007


Michael Friendly wrote:
> Dear R community
> 
> In a current paper, I'm (briefly) considering the topic of producing
> scatterplots or maps with point labels positioned in such a way as to 
> minimize label overlap and occlusion.  This is a topic with a large, but 
> scattered literature. In CS, it is considered NP-hard, but there are
> a variety of approximate solutions.  The most complete bibliography I've 
> found is
> the Map-Labeling Bibliography,
> http://liinwww.ira.uka.de/bibliography/Theory/map.labeling.html
> 
> AFAIK, the only concrete and published implementation is a Fortran
> program published by Noma (below), and then adapted by Warren Kuhfeld
> at SAS in PROC PLOT, and used in his %plotit macro.
> 
>      Journal Title  - Psychometrika
>      Article Title  - Heuristic method for label placement in scatterplots
>      Volume  - Volume 52
>      Issue  - 3
>      First Page  - 463
>      Last Page  - 468
>      Issue Cover Date  - 1987-09-27
>      Author  - Elliot Noma
>      DOI  - 10.1007/BF02294366
>      Link  - http://www.springerlink.com/content/c4k6205r83156165
> 
> Does anyone know of a related R (or other) public implementation of a 
> solution to this problem?

  One thing that comes to mind is labcurve() in Frank Harrell's Hmisc
package.

"Optionally draws a set of curves then labels the curves. A variety of
methods for drawing labels are implemented, ranging from positioning
using the mouse to automatic labeling to automatic placement of key
symbols with manual placement of key legends to automatic placement of
legends. For automatic positioning of labels or keys, a curve is labeled
at a point that is maximally separated from all of the other curves.
Gaps occurring when curves do not start or end at the same x-coordinates
are given preference for positioning labels. If labels are offset from
the curves (the default behaviour), if the closest curve to curve i is
above curve i, curve i is labeled below its line. If the closest curve
is below curve i, curve i is labeled above its line. These directions
are reversed if the resulting labels would appear outside the plot region."

> thanks,
> -Michael

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894



More information about the R-help mailing list