[R] Stting non-overlaping text positions

Greg Snow Greg.Snow at imail.org
Fri Jul 24 19:13:40 CEST 2009


A general solution is not simple, some options include:

The thigmophobe.labels function in the plotrix package will place labels on the side of a point furthest from the closest point (works well in some cases, but does not guarantee non-overlap).

The dynIdentify and TkIdentify functions in the TeachingDemos package help with the manual placing of labels (may make things easy enough to do it manually (dragging labels with the mouse)).

The spread.labs function in the TeachingDemos package will spread out labels in 1 dimension (for some structures of plots you can use this with 2 dimensional data, see the example).

The spread.labels function in plotrix does an even spreading.

I have tried several different ways to expand the spread.labs idea to 2 dimensions, but things that work for some situations don't work well for others.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Ana Conesa
> Sent: Friday, July 24, 2009 6:30 AM
> To: r-help at r-project.org
> Subject: [R] Stting non-overlaping text positions
> 
> Dear List
> 
> I am having problems to set text labels in a scatter plot. At some
> areas dots
> are close and labels overlap and texts cannot be read. I have too many
> dots
> to adjust this manually. Is there any function that will calculate the
> label
> offsets to avoid this overlapping problem?
> 
> Thanks
> 
> 
> Ana
> 
> --
> Ana Conesa
> Bioinformatics and Genomics Department
> Centro de Investigaciones Principe Felipe
> Avda. Autopista Saler 16,
> 46012 Valencia, Spain
> Phone: +34 96 328 96 80
> Fax:   +34 96 328 97 01
> http://bioinfo.cipf.es/aconesa
> http://www.blast2go.org
> ==========================================
> FIRST INTERNATIONAL COURSE IN AUTOMATED
> FUNCTIONAL ANNOTATION AND DATA MINING
> Valencia/Orlando, September/October 2009
> http://bioinfo.cipf.es/blast2gocourse
> 
> ______________________________________________
> 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.




More information about the R-help mailing list