Canonical correlation analysis is a technique to study and measure the rapport between two sets of variables, and each set consisting of two or more indicators. Note that the max. number of canonical functions that can be found equals the least variables in any set. For example, if the first set consists of 8 indicators and the second group consists of 10 indicators, the max. canonical functions that can be obtained are 8. see, Elamir, E.A. (2020) Determinant indicators for labor market efficiency and higher education and training: evidence from MENA countries. Problems and Perspectives in Management, 18, 206-2018.
This is how to plot canonical correlation in r using two sets say E (3 indicators) and I (2 indicators), then canonical functions are 2.
library(DiagrammeR)
grViz("digraph {
graph [layout=dot rankdir=LR]
subgraph cluster1 {
label = 'Set 1: E'
{x1 x2 x3} -> {canX1 canX2}
}
subgraph cluster2 {
label = 'set 2: I'
{canY1 canY2} -> {y1 y2} [dir=back]
}
canX1 -> canY1 [label='r= ...' fontsize=10 color=green dir=both]
canX2 -> canY2 [label='r= ...' fontsize=10 color=yellow dir=both]
}")