[R] Fwd: Re: Graph color

Greg Snow Greg.Snow at imail.org
Mon Feb 1 18:20:22 CET 2010


What you are asking (making labels of points not overlap the points) is either very simple or very complicated, depending on your data and what you want the results to look like.

It may be as simple as text(x, y-strheight('A'), labels).

If that does not do what you want, then there is thigmophobe.labels in the plotrix package (already mentioned by Jim Lemon) which works great for some datasets.  Also spread.labels (plotrix package) and spread.labs (TeachingDemos package) work in different situations.  There may be some other automated attempts in other packages, but they are not coming to mind.  A less automatic approach that gives you more control is the dynIdentify/TkIdentify functions (TeachingDemos package).

If you want rectangles around the labels, then you may want the boxed.labels function (plotrix).  If you want to do your own rectangles then there are the rect and symbols functions.

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 Jose Narillos de Santos
> Sent: Friday, January 29, 2010 4:30 PM
> To: Jim Lemon; r-help at r-project.org; baptiste auguie
> Subject: Re: [R] Fwd: Re: Graph color
> 
> Hi Jim,
> 
> Last question.
> 
> I´m using a spanish version (there are some documents on how
> constructing
> good plots and I have found them althought not very intuitive...) I
> will
> read them in a next days.
> 
> Only if you know the way.
> 
> Imagine I have made a plot like plot(x,y)
> 
> and I use labels (on each cross point appears a name) but they appear
> on the
> dot ¿Do you know some way to show the label below the dot? there is
> some way
> to indicate the program try to not to overlap labels (if they are very
> near?)
> 
> Happy nice wekend all¡¡¡
> 
> 2010/1/29 Jim Lemon <jim at bitwrit.com.au>
> 
> > On 01/29/2010 10:08 AM, Jose Narillos de Santos wrote:
> >
> >> Hi Jim your suggestion doesn´t work properly. I have find some
> documents
> >> on graphs so let me think till monday and if not I will detail where
> it
> >> fails.
> >> Sorry again...I feel very silly, really, it is not a joke but I will
> >> continue trying...
> >> I have a question also, in a general plot (please if you can help me
> it
> >> would be fantastic)
> >> Imagine again a plot
> >>
> >>  > x <- rnorm(10)
> >>
> >>  > y <- rnorm(10)
> >>
> >> If I plot(x,y)
> >>
> >> it appears a scatter plot.
> >>
> >> If you see y axis (the y axis on the left) has numbers. But the
> parallel
> >> (imaginary)  y axis on the right appears only as a line (without the
> >> numbers, the scale).
> >>
> >> Do you know how to show the scale the same numbers in both (left and
> >> right axis)? I think this way the graphs seem more simetrical.
> >>
> > Hi Jose,
> > Try this:
> >
> > par(mar=c(5,4,4,4))
> > plot(rnorm(10),rnorm(10))
> > axis(4)
> >
> > Jim
> >
> >
> 
> 	[[alternative HTML version deleted]]



More information about the R-help mailing list