Re: [R] Avoiding overplotting of text.

From: <Richard.Cotton_at_hsl.gov.uk>
Date: Mon, 25 Feb 2008 10:55:34 +0000


> I am plotting some data, and use text() to get variable names next to
> points on the graph. What is the best way to make sure that these text
> labels are readable and not overlapping when two datapoints are close?
> I've tried using jitter(), but the effect is random and doesn't always
> give a good result.

It is probably possible to calculate the space that each label takes up on the page, and write some logic to automatically reposition the labels. This however is almost certainly very tricky to do properly. The easier options are:

  1. If you only have a few labels, and it's just one or two graphs, manually reposition them.
  2. Make the text smaller and/or make the device size larger.
  3. Draw the labels in different colours so that they can be distinguished even when they overlap.
  4. Don't draw the labels on the plotting region; use a key instead.

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION: This message contains privileged and confidential inform...{{dropped:20}}

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. Received on Mon 25 Feb 2008 - 10:57:44 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 Mon 25 Feb 2008 - 11:30:16 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.

list of date sections of archive