projects
/
iramuteq
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
abf9eaf
)
load rgl before graph 3d
author
pierre
<ratinaud@univ-tlse2.fr>
Thu, 3 Jun 2021 07:31:12 +0000
(09:31 +0200)
committer
pierre
<ratinaud@univ-tlse2.fr>
Thu, 3 Jun 2021 07:31:12 +0000
(09:31 +0200)
Rscripts/Rgraph.R
patch
|
blob
|
history
diff --git
a/Rscripts/Rgraph.R
b/Rscripts/Rgraph.R
index
af0b351
..
8407e31
100644
(file)
--- a/
Rscripts/Rgraph.R
+++ b/
Rscripts/Rgraph.R
@@
-14,7
+14,7
@@
# dev.off()
#}
# 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
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])) {
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.0
2
)
+ yval <- yval-(strheight(word.to.plot[j,i],cex=vcex[j])+0.0
1
)
text(-0.9, yval, word.to.plot[j,i], cex = vcex[j], col = col, adj=0)
}
}
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)
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))
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
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
}
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]
}
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))
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.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
}
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
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) {
V(g)$x <- layout[,1]
V(g)$y <- layout[,2]
if (ncol(layout) == 3) {