Script Use of Lexicometry in Sensometrics

Figure 6. Words related to fruit and wood.

Selection of words:

word.sel <- "fruit"
sel1<- which(substr(rownames(res.mfact.23$freq$coord),1,nchar(word.sel))==word.sel)
word.sel <- "fruita"
sel2<- which(substr(rownames(res.mfact.23$freq$coord),1,nchar(word.sel))==word.sel)
word.sel <- "bois"
sel3<- which(substr(rownames(res.mfact.23$freq$coord),1,nchar(word.sel))==word.sel)
word.sel <- "nonbois"
sel4<- which(substr(rownames(res.mfact.23$freq$coord),1,nchar(word.sel))==word.sel)
word.sel <- "afrutat"
sel5<- which(substr(rownames(res.mfact.23$freq$coord),1,nchar(word.sel))==word.sel)
word.sel <- "bota"
sel6<- which(substr(rownames(res.mfact.23$freq$coord),1,nchar(word.sel))==word.sel)
word.sel <- "roure"
sel7<- which(substr(rownames(res.mfact.23$freq$coord),1,nchar(word.sel))==word.sel)
sel<-c(sel1,sel2,sel3,sel4,sel5,sel6,sel7)
sel.words <- rownames(res.mfact.23$freq$coord)[sel]
sel.words
 [1] "fruit"      "fruité"     "fruit.1"    "fruité.1"   "fruité.2"  
 [6] "fruit.2"    "fruité.3"   "fruité.4"   "fruit.3"    "fruit.4"   
[11] "fruité.5"   "fruit.5"    "fruité.6"   "fruité.7"   "fruita"    
[16] "fruita.1"   "fruita.2"   "fruitsec"   "fruita.3"   "fruita"    
[21] "fruita.1"   "fruita.2"   "fruita.3"   "boisé"      "bois"      
[26] "boisé.1"    "boisé.2"    "boisé.3"    "boisé.4"    "bois.1"    
[31] "boisé.5"    "boisé.6"    "bois.2"     "boisé.7"    "bois.3"    
[36] "boisé.8"    "boisé.9"    "bois.4"     "nonboisé"   "nonboisé.1"
[41] "nonboisé.2" "afrutat"    "bota"       "roure"

 

Figure 6 without colors axes (1,2):

plot.MFA(res.mfact.23,choix=c("freq"),invisible=c("row","col.sup"),select=sel.words,unselect=1,
legend=list(plot=FALSE),habillage="none",autoLab = c("yes"),cex=0.8,
title="Individual words related to wood or fruit",graph.type="classic")

Figure 6 without colors axes (3,4):

plot.MFA(res.mfact.23,choix=c("freq"),invisible=c("row","col.sup"),select=sel.words,unselect=1,
legend=list(plot=FALSE),habillage="none",autoLab = c("yes"),cex=0.8,axes=c(3,4),
title="Individual words related to wood or fruit",graph.type="classic")

 

Position of words related to fruit pos.fruit (Type 1, fruit)

pos.fruit <- c(1:23,42)
sel.words[pos.fruit]
 [1] "fruit"    "fruité"   "fruit.1"  "fruité.1" "fruité.2" "fruit.2" 
 [7] "fruité.3" "fruité.4" "fruit.3"  "fruit.4"  "fruité.5" "fruit.5" 
[13] "fruité.6" "fruité.7" "fruita"   "fruita.1" "fruita.2" "fruitsec"
[19] "fruita.3" "fruita"   "fruita.1" "fruita.2" "fruita.3" "afrutat" 

Position of words related to wood (Type 2, wood)

pos.wood <- c(24:38,43,44)
sel.words[pos.wood]
 [1] "boisé"   "bois"    "boisé.1" "boisé.2" "boisé.3" "boisé.4" "bois.1" 
 [8] "boisé.5" "boisé.6" "bois.2"  "boisé.7" "bois.3"  "boisé.8" "boisé.9"
[15] "bois.4"  "bota"    "roure"  

Position of words related to nonwood (Type 3, nonwood)

pos.nonb <- c(39:41)
sel.words[pos.nonb]
"nonboisé"   "nonboisé.1" "nonboisé.2"
Coord.Fig6 <- as.data.frame(res.mfact.23$freq$coord[sel.words,])
Coord.Fig6$type <- 1
Coord.Fig6$type[pos.wood] <- 2
Coord.Fig6$type[pos.nonb] <- 3
Coord.Fig6$type <- factor(Coord.Fig6$type)
col1<- c("black", "white", "#33CC33")
col2<- c("white", "black", "white")
font.type <- c("bold", "bold", "bold.italic")
set.seed(1234)
Figure6 <- ggplot(Coord.Fig6)+
theme_light() + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())+
xlab(labx)+ ylab(laby) + coord_fixed()+
geom_hline(yintercept=0, linetype="dashed", color = "grey")+
geom_vline(xintercept=0, linetype="dashed", color = "grey")+
geom_label_repel(size=6, fontface = font.type[Coord.Fig6$type], max.overlaps=44,
box.padding = unit(0.35, "lines"),
aes(x=Dim.1, y=Dim.2, label = rownames(Coord.Fig6),
fill = type, color=type))+
theme( axis.text.x = element_text(size=rel(1.6)))+
theme( axis.text.y = element_text(size=rel(1.6)))+
labs(x=labx)+labs(y=laby)+
theme(axis.title.x= element_text(size=17, face="bold"))+
theme(axis.title.y= element_text(size=17, face="bold"))+
theme(plot.margin = grid::unit(c(t=5,r= 2,b=5, l=2), "mm"))+
scale_fill_manual(values = setNames(col1, levels(Coord.Fig6$type))) +
scale_color_manual(values = setNames(col2, levels(Coord.Fig6$type)))+
theme (legend.position="none") +
ggtitle("Figure 6. Individual words related to wood or fruit")+
ylim(-1.3, 1.7)

 

To plot Figure 6:

set.seed(1234)
Figure6