classes <- classes[order(cex.par, decreasing = TRUE)]
cex.par <- cex.par[order(cex.par, decreasing = TRUE)]
table.out <- stopoverlap(table.in, cex.par=cex.par, xlim = c(xmin,xmax), ylim = c(ymin,ymax))
- table.in <- table.out$toplot
+ table.in <- table.out$toplot
notplot <- table.out$notplot
if (! is.null(notplot)) {
write.csv2(notplot, file = paste(filename, '_notplotted.csv', sep = ''))
isOverlaped <- FALSE
} else {
if(r>sqrt(.5)){
- print(paste(words[i], "could not be fit on page. It will not be plotted."))
+ #print(paste(words[i], "could not be fit on page. It will not be plotted."))
notplot <- rbind(notplot,c(words[i], x[i,1], x[i,2], size[i], i))
isOverlaped <- FALSE
}
}
}
}
+ nbnot <- nrow(notplot)
+ print(paste(nbnot, ' not plotted'))
row.names(toplot) <- words[toplot[,4]]
return(list(toplot = toplot, notplot = notplot))
}
return(toplot)
}
+new_tree_tot <- function(chd) {
+ lf <- chd$list_fille
+ m <- matrix(0, ncol=2)
+ for (val in 1:length(lf)) {
+ if (! is.null(lf[[val]])) {
+ print(c(val,lf[[val]][1]))
+ m <- rbind(m, c(val,lf[[val]][1]))
+ m <- rbind(m, c(val,lf[[val]][2]))
+ }
+ }
+ m[-1,]
+}
+
make_tree_tot <- function (chd) {
library(ape)
lf<-chd$list_fille
colors
}
-make_afc_graph <- function(toplot, classes, clnb, xlab, ylab, cex.txt = NULL, leg = FALSE, cmd = FALSE, black = FALSE, xminmax=NULL, yminmax=NULL) {
+make_afc_graph <- function(toplot, classes, clnb, xlab, ylab, cex.txt = NULL, leg = FALSE, cmd = FALSE, black = FALSE, xminmax=NULL, yminmax=NULL, color=NULL) {
rain <- rainbow(clnb)
compt <- 1
if (black) {
cl.color <- 'black'
}
+ if (!is.null(color)) {
+ cl.color <- color
+ }
plot(toplot[,1],toplot[,2], pch='', xlab = xlab, ylab = ylab, xlim=xminmax, ylim = yminmax)
abline(h=0, v=0, lty = 'dashed')
if (is.null(cex.txt))
tree[[2]]<-paste('classe ',tree[[2]])
}
par(mar=c(2,1,0,1))
- plot.phylo(tree,label.offset=0, tip.col=col, type=type.dendro, direction = 'downwards', srt=90, adj = 0.5, cex = 1, y.lim=c(-0.3,tree$Nnode))
+ plot.phylo(tree,label.offset=0, tip.col=col, type=type.dendro, direction = 'downwards', srt=90, adj = 0.5, cex = 1.5, y.lim=c(-0.3,tree$Nnode))
par(mar=c(0,0,0,0))
d <- barplot(-sum.cl[tree.order], col=col, names.arg='', axes=FALSE, axisname=FALSE)
text(x=d, y=(-sum.cl[tree.order]+3), label=paste(round(sum.cl[tree.order],1),'%'), cex=1)
#wordcloud(names(lclasses[[i]]), lclasses[[i]], scale = c(1.5, 0.2), random.order=FALSE, colors = colcloud[i])
yval <- 1.1
plot(0,0,pch='', axes = FALSE)
- vcex <- norm.vec(lclasses[[i]], 1, 3)
+ vcex <- norm.vec(lclasses[[i]], 2, 3)
for (j in 1:length(lclasses[[i]])) {
yval <- yval-(strheight( names(lclasses[[i]])[j],cex=vcex[j])+0.02)
text(-0.9, yval, names(lclasses[[i]])[j], cex = vcex[j], col = colcloud[i], adj=0)
}
par(mar=c(0,0,0,0))
plot(0, axes = FALSE, pch = '')
- legend(x = 'center' , rownames(to.plot), fill = col.bars)
+ legend(x = 'center' , rev(rownames(to.plot)), fill = rev(col.bars))
if (!cmd) {
dev.off()
}
}
+
graph.to.file <- function(graph.simi, nodesfile = NULL, edgesfile = NULL, community = FALSE, color = NULL, sweight = NULL) {
require(igraph)
g <- graph.simi$graph
df
}
}
+
+graph.to.file2 <- function(graph, layout, nodesfile = NULL, edgesfile = NULL, community = FALSE, color = NULL, sweight = NULL) {
+ require(igraph)
+ g <- graph
+ V(g)$x <- layout[,1]
+ V(g)$y <- layout[,2]
+ if (ncol(layout) == 3) {
+ V(g)$z <- layout[,3]
+ }
+ v.colors <- col2rgb(V(g)$color)
+ V(g)$r <- v.colors[1,]
+ V(g)$g <- v.colors[2,]
+ V(g)$b <- v.colors[3,]
+
+ if (!is.null(sweight)) {
+ V(g)$sweight <- sweight
+ }
+ df <- get.data.frame(g, what='both')
+ if (!is.null(nodesfile)) {
+ write.table(df$vertices, nodesfile, sep='\t', row.names=FALSE)
+ }
+ if (!is.null(edgesfile)) {
+ write.table(df$edges, edgesfile, sep='\t', row.names=FALSE)
+ }
+ if (is.null(edgesfile) & is.null(nodesfile)) {
+ df
+ }
+}
+