From: pierre Date: Thu, 3 Jun 2021 07:31:12 +0000 (+0200) Subject: load rgl before graph 3d X-Git-Url: http://iramuteq.org/git?a=commitdiff_plain;h=097e7017a8f1c597573e7baf9d23553b274eabd1;p=iramuteq load rgl before graph 3d --- diff --git a/Rscripts/Rgraph.R b/Rscripts/Rgraph.R index af0b351..8407e31 100644 --- a/Rscripts/Rgraph.R +++ b/Rscripts/Rgraph.R @@ -14,7 +14,7 @@ # dev.off() #} -PlotDendroCut <- function(chd,filename,reso,clusternb) { +PlotDendroCut <- function(chd,filename,reso,clusternb) { h.chd <- as.hclust(chd) memb <- cutree(h.chd, k = clusternb) cent <- NULL @@ -951,7 +951,7 @@ plot.spec <- function(spec, nb.word = 20) { vcex <- norm.vec(word.size[,i], 2, 3) text(-0.9, -0.5, cn[i], cex = 1, adj=0, srt=90, col='black') for (j in 1:length(word.size[,i])) { - yval <- yval-(strheight(word.to.plot[j,i],cex=vcex[j])+0.02) + yval <- yval-(strheight(word.to.plot[j,i],cex=vcex[j])+0.01) text(-0.9, yval, word.to.plot[j,i], cex = vcex[j], col = col, adj=0) } } @@ -996,6 +996,7 @@ plot.alceste.graph <- function(rdata,nd=3,layout='fruke', chilim = 2) { make.simi.afc <- function(x,chitable,lim=0, alpha = 0.1, movie = NULL) { library(igraph) + library(rgl) chimax<-as.matrix(apply(chitable,1,max)) chimax<-as.matrix(chimax[,1][1:nrow(x)]) chimax<-cbind(chimax,1:nrow(x)) @@ -1192,19 +1193,20 @@ graphml.to.file <- function(graph.path) { graph.to.file <- function(graph.simi, nodesfile = NULL, edgesfile = NULL, community = FALSE, color = NULL, sweight = NULL) { require(igraph) g <- graph.simi$graph - print(graph.simi$eff) + #print(graph.simi$eff) if (!is.null(graph.simi$eff)) { V(g)$weight <- graph.simi$eff } else { V(g)$weight <- graph.simi$label.cex } - layout <- layout.norm(graph.simi$layout,-5,5,-5,5,-5,5) - print(layout) + layout <- layout.norm(graph.simi$layout,-10,10,-10,10,-10,10) + #print(layout) V(g)$x <- layout[,1] V(g)$y <- layout[,2] if (ncol(layout) == 3) { V(g)$z <- layout[,3] } + E(g)$weight <- graph.simi$we.width if (community) { member <- graph.simi$communities$membership col <- rainbow(max(member)) @@ -1218,7 +1220,7 @@ graph.to.file <- function(graph.simi, nodesfile = NULL, edgesfile = NULL, commun v.colors <- col2rgb(color) V(g)$r <- v.colors[1,] V(g)$g <- v.colors[2,] - V(g)$b <- v.colors[3,] + V(g)$b <- v.colors[3,] } if (!is.null(sweight)) { V(g)$sweight <- sweight @@ -1238,6 +1240,7 @@ graph.to.file <- function(graph.simi, nodesfile = NULL, edgesfile = NULL, commun graph.to.file2 <- function(graph, layout, nodesfile = NULL, edgesfile = NULL, community = FALSE, color = NULL, sweight = NULL) { require(igraph) g <- graph + layout <- layout.norm(layout,-5,5,-5,5,-5,5) V(g)$x <- layout[,1] V(g)$y <- layout[,2] if (ncol(layout) == 3) {