Word Layout
finds text plot layout coordinates such that no text overlaps
wordlayout(x, y, words, cex=1, rotate90 = FALSE, xlim=c(-Inf,Inf), ylim=c(-Inf,Inf), tstep=.1, rstep=.1, ...)
x |
x coordinates |
y |
y coordinates |
words |
the text to plot |
cex |
font size |
rotate90 |
a value or vector indicating whether words should be rotated 90 degrees |
xlim |
x axis bounds for text |
ylim |
y axis bounds for text |
tstep |
the angle (theta) step size as the algorithm spirals out |
rstep |
the radius step size (in standard deviations) as the algorithm spirals out |
... |
Additional parameters to be passed to strwidth and strheight. |
A matrix with columns representing x, y width and height.
#calculate standardized MDS coordinates dat <- sweep(USArrests,2,colMeans(USArrests)) dat <- sweep(dat,2,sqrt(diag(var(dat))),"/") loc <- cmdscale(dist(dat)) x <- loc[,1] y <- loc[,2] w <- rownames(loc) #plot with no overlap and all words visible plot(x,y,type="n",xlim=c(-3,3),ylim=c(-3,2)) lay <- wordlayout(x,y,w,xlim=c(-3,3),ylim=c(-3,2)) text(lay[,1]+.5*lay[,3],lay[,2]+.5*lay[,4],w) #notice north dakota is only partially visible textplot(x,y,w)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.