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

 

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]

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

pos.wood <- c(24:38,43,44)
sel.words[pos.wood]

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

pos.nonb <- c(39:41)
sel.words[pos.nonb]

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