- #cols <- rainbow(clnb)
- boxes <- list()
- for (i in 1:nrow(x)) {
- rotWord <- runif(1)<rot.per
- r <-0
- theta <- runif(1,0,2*pi)
- x1<- x[i,1]
- y1<- x[i,2]
- wid <- strwidth(words[i],cex=size[i])
- ht <- strheight(words[i],cex=size[i])
- if(grepl(tails,words[i]))
- ht <- ht + ht*.2
- if(rotWord){
- tmp <- ht
- ht <- wid
- wid <- tmp
- }
- isOverlaped <- TRUE
- while(isOverlaped){
- if(!overlap(x1-.5*wid,y1-.5*ht,wid,ht, boxes)) { #&&
- toplot <- rbind(toplot, c(x1, y1, size[i], i))
- #text(x1,y1,words[i],cex=size[i],offset=0,srt=rotWord*90,
- # col=cols[classes[i]])
- boxes[[length(boxes)+1]] <- c(x1-.5*wid,y1-.5*ht,wid,ht)
- isOverlaped <- FALSE
- } else {
- if(r>sqrt(.5)){
- print(paste(words[i], "could not be fit on page. It will not be plotted."))
- isOverlaped <- FALSE
- }
- theta <- theta+thetaStep
- r <- r + rStep*thetaStep/(2*pi)
- x1 <- x[i,1]+r*cos(theta)
- y1 <- x[i,2]+r*sin(theta)
- }
- }
+ if (is.null(yminmax)) {
+ yminmax <- c(min(table.in[,2], na.rm = TRUE) + ((max(cex.par)/10) * min(table.in[,2], na.rm = TRUE)), max(table.in[,2], na.rm = TRUE) + ((max(cex.par)/10) * max(table.in[,2], na.rm = TRUE)))