[R] Overlapping Plot Labels and Color Palette
Jim Lemon
jim at bitwrit.com.au
Tue Dec 1 04:50:14 CET 2009
On 12/01/2009 01:56 PM, Brock Tibert wrote:
> Hi all,
>
> I am new to R, but with the help I have received thus,I have already been able to work through a bunch of questions on my own in just a few days. I imagine my questions are relatively simple, but here she goes.
>
> 1) I am using a package where one of the objects generated represents X/Y coordinates for each observation. I have been able to plot my row names onto the graph using text() (with the help of this list), but because it is entirely possible for some rows to have the same X/Y coordinates, I need to separate the data labels so that I can clearly see each.
>
> I tried text(jitter(coordinates), labels = abbreviate(rownames(dataset), minlength=3)), but it appears that jitter effect is the same for each x/y pair and not unique to each row.
>
>
Hi Brock,
You have just found another use for the "spreadout" function in the
plotrix package:
plot(1:10,type="n")
labels<-c("one","two","three","four","five","six",
"seven","eight","nine","ten")
xpos<-c(2,2,4,4,6,6,8,8,9,9)
ypos<-c(2,2,4,4,6,6,8,8,9,9)
library(plotrix)
text(xpos,spreadout(ypos,0.3),labels)
Jim
More information about the R-help
mailing list