Hi to the experts,
I'm attempting to generate a pairs() plot using the plotMEpairs() function in WGCNA. My current code looks very simple as following;
plotMEpairs(MEs, traitsDat$blade_Na, cex.labels=12)
My MEs
data frame looks like this
head(MEs)
darkgoldenrod4 darkseagreen3 brown3 palevioletred3 darkolivegreen
1 0.1547894 0.15358785 0.00863432 0.21155555 0.14404473
2 0.2276100 0.18018804 0.10890920 0.27717332 0.14444103
3 0.1427315 0.14522530 -0.38375679 -0.11940695 -0.23971664
4 0.1709225 0.15518469 0.13983453 0.40029139 -0.07366996
5 -0.1231839 0.03224154 0.28591815 -0.04757507 0.06252794
6 -0.2057145 -0.05495319 -0.46779093 -0.38743274 -0.10632115
My traitsDat
data frame looks like this
head(traitsDat)
blade_Na sheath_Na blade_K sheath_K blade_K_Na sheath_K_Na SBK_SBNa
L1A-A-R 2351.8181 2887 823.9930 578 0.3503643 0.2002216 0.57
L2A-A-R 2573.5617 3309 823.6208 450 0.3200315 0.1361210 0.43
L3A-A-R 2339.7940 3101 659.0464 467 0.2816686 0.1506410 0.53
L4A-A-R 2242.5629 3080 685.5601 496 0.3057038 0.1609653 0.53
L1B-B-R 1315.1276 1313 932.4009 1210 0.7089814 0.9212283 1.30
L2B-B-R 627.4885 563 1098.9011 1439 1.7512690 2.5588874 1.46
I can come up with an output like this
Now, what I actually want is to
- match each of the diagonal histogram colour to the corresponding
colnames(MEs)
and, - have the scatter plots in the upper triangle to be coloured as following; the first 4 values for a plot in one colour, 5-8 in another, 9-12 in another ... 20-24 in another (
NROW(MEs) is 24
).
I'm quite sure that this is possible through manipulating the panel.hist
and/or panel.smooth
. But I'm not able to figure it out after 2 days of struggling. Any help would be very much appreciated.
Thanks a lot in advance
Shani
Hi Kevin,
Thank you for this. However, In the panel.hist() however an error occurs :
Error: '...' used in an incorrect context.
Yes you are right pairs() is a very powerful function to master. Any help with this one for me? Thank you.