Problem with 15.2.1 Other plotting/Adjacency matrix plots

6 views
Skip to first unread message

Lucia

unread,
Oct 25, 2018, 4:31:57 AM10/25/18
to brainGraph-help
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,

Chris Watson

unread,
Oct 25, 2018, 7:17:39 PM10/25/18
to brainGr...@googlegroups.com
Yes, it's possible that there aren't enough colors applied by the function. This was just a "hack" that I wrote quickly and should not have hard-coded it. If you send me your data, though, I can take a look at it.
I have been working on updating that function for improved performance and usability, but I don't have an estimate for when it will be done.

Chris

--
You received this message because you are subscribed to the Google Groups "brainGraph-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brainGraph-he...@googlegroups.com.
To post to this group, send email to brainGr...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brainGraph-help/bbf822a5-011f-4a1d-bbb0-89ef71804b53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages