Hello again Chris,
I am writing because I now have a problem related to Adjacency matrix plots. The code you give is
matplot.comm1 <- plot_corr_mat(corrs[[1]]$r.thresh[, , 10], type='comm',
g=g[[1]][[10]], group=groups[1])
matplot.comm2 <- plot_corr_mat(corrs[[2]]$r.thresh[, , 10], type='comm',
g=g[[2]][[10]], group=groups[2])
matplot.lobe1 <- plot_corr_mat(corrs[[1]]$r.thresh[, , 10], type='lobe',
g=g[[1]][[10]], group=groups[1])
matplot.lobe2 <- plot_corr_mat(corrs[[2]]$r.thresh[, , 10], type='lobe',
g=g[[2]][[10]], group=groups[2])
# To plot both in the same device, uncomment the following line
#grid.arrange(matplot.comm1, matplot.comm2, nrow=1, ncol=2)
print(matplot.comm1)
print(matplot.comm2)
print(matplot.lobe1)
print(matplot.lobe2)
I don't have a problem with matplot.lobe1 and matplot.lobe2, but I do with the communities matrices.
> print(matplot.comm1)
Error: Insufficient values in manual scale. 23 needed but only 22 provided.
> print(matplot.comm2)
Error: Insufficient values in manual scale. 26 needed but only 22 provided.
What I think is that the problem is within the color levels. When I do str(matplot.comm1$data) I obtain the following
Classes ‘data.table’ and 'data.frame': 12996 obs. of 9 variables:
$ Var1 : Factor w/ 114 levels "L_LOF_1","L_LOF_2",..: 1 2 3 4 5 6 7 8 9 10 ...
$ Var2 : Factor w/ 114 levels "L_LOF_1","L_LOF_2",..: 1 1 1 1 1 1 1 1 1 1 ...
$ value : num 1 1 1 0 0 0 0 0 0 0 ...
$ memb1 : num 1 1 1 1 1 1 1 1 1 1 ...
$ memb2 : num 1 1 1 1 1 1 1 1 1 1 ...
$ memb : Factor w/ 23 levels "1","2","3","4",..: 1 1 1 23 23 23 23 23 23 23 ...
$ legend.t : chr "Communities (#)" "Communities (#)" "Communities (#)" "Communities (#)" ...
$ color : Factor w/ 22 levels "red","green",..: 1 1 1 22 22 22 22 22 22 22 ...
$ color.text: chr "red" "red" "red" "red" ...
- attr(*, ".internal.selfref")=<externalptr>
Whereas when I do it with matplot.comm.2
Classes ‘data.table’ and 'data.frame': 12996 obs. of 9 variables:
$ Var1 : Factor w/ 114 levels "L_PCF_1","L_PCF_2",..: 1 2 3 4 5 6 7 8 9 10 ...
$ Var2 : Factor w/ 114 levels "L_PCF_1","L_PCF_2",..: 1 1 1 1 1 1 1 1 1 1 ...
$ value : num 1 1 1 1 1 1 0 0 1 0 ...
$ memb1 : num 1 1 1 1 1 1 1 1 1 1 ...
$ memb2 : num 1 1 1 1 1 1 1 1 1 1 ...
$ memb : Factor w/ 26 levels "1","2","3","4",..: 1 1 1 1 1 1 26 26 1 26 ...
$ legend.t : chr "Communities (#)" "Communities (#)" "Communities (#)" "Communities (#)" ...
$ color : Factor w/ 22 levels "red","green",..: 1 1 1 1 1 1 22 22 1 22 ...
$ color.text: chr "red" "red" "red" "red" ...
- attr(*, ".internal.selfref")=<externalptr>
As you can see, I've highlighted in blue the rows of memb and color for both data.table. I don't know how to make it have the same number of memb and color. Also, I don't know if this error is due to having a brain segmentation too small and there are too many comunities.
Regards,