| 1 |
\begin{tikzpicture} |
| 2 |
\begin{sankeydiagram}%[debug] |
| 3 |
\sffamily |
| 4 |
\sankeyset{ |
| 5 |
ratio=1cm/10, |
| 6 |
outin steps=2, |
| 7 |
draw/.style={draw=none,line width=0pt}, |
| 8 |
color/.style={fill/.style={fill=#1,fill opacity=.75}}, |
| 9 |
shade/.style 2 args={fill/.style={left color=#1, |
| 10 |
right color=#2,fill opacity=.5}}, |
| 11 |
% colors |
| 12 |
@define HTML color/.code args={#1/#2}{\definecolor{#1}{HTML}{#2}}, |
| 13 |
@define HTML color/.list={ |
| 14 |
cyan/a6cee3,lime/b2df8a,red/fb9a99,orange/fdbf6f, |
| 15 |
violet/cab2d6,yellow/ffff99,blue/1f78b4,green/33a02c |
| 16 |
}, |
| 17 |
% colors of countries |
| 18 |
@let country color/.code args={#1/#2}{\colorlet{#1}[rgb]{#2}}, |
| 19 |
@let country color/.list={ |
| 20 |
CA/red,US/orange,MX/orange,BR/cyan,FR/lime,GB/red, |
| 21 |
SP/lime,PT/cyan,ML/blue,SN/violet,MA/yellow, |
| 22 |
AO/violet,ZA/yellow,IN/green,JP/green,CN/blue |
| 23 |
}, |
| 24 |
} |
| 25 |
\def\vdist{5mm} |
| 26 |
\def\hwidth{.5em} |
| 27 |
\def\hdist{4.1cm} |
| 28 |
|
| 29 |
\sankeynode{name=CA,quantity=7} |
| 30 |
\sankeynode{name=US,quantity=8,at={[yshift=\vdist]CA.left},anchor=right} |
| 31 |
\sankeynode{name=MX,quantity=8,at={[yshift=\vdist]US.left},anchor=right} |
| 32 |
\sankeynode{name=BR,quantity=8,at={[yshift=\vdist]MX.left},anchor=right} |
| 33 |
|
| 34 |
\foreach \country in {CA,US,MX,BR}{ |
| 35 |
\sankeyadvance[color=\country]{\country}{\hwidth} |
| 36 |
} |
| 37 |
|
| 38 |
\sankeyfork{CA}{1/CA-to-PT,1/CA-to-GB,5/CA-to-FR} |
| 39 |
\sankeyfork{US}{1/US-to-PT,1/US-to-SP,5/US-to-GB,1/US-to-FR} |
| 40 |
\sankeyfork{MX}{1/MX-to-PT,5/MX-to-SP,1/MX-to-GB,1/MX-to-FR} |
| 41 |
\sankeyfork{BR}{5/BR-to-PT,1/BR-to-SP,1/BR-to-GB,1/BR-to-FR} |
| 42 |
|
| 43 |
\sankeynode{name=FR,quantity=11, |
| 44 |
at={[xshift=\hdist]CA.right},anchor=right} |
| 45 |
\sankeynode{name=GB,quantity=11, |
| 46 |
at={[yshift=\vdist]FR.left},anchor=right} |
| 47 |
\sankeynode{name=SP,quantity=7, |
| 48 |
at={[yshift=\vdist]GB.left},anchor=right} |
| 49 |
\sankeynode{name=PT,quantity=8, |
| 50 |
at={[yshift=\vdist]SP.left},anchor=right} |
| 51 |
|
| 52 |
\sankeyfork{FR} |
| 53 |
{1/FR-from-BR,1/FR-from-MX,1/FR-from-US,5/FR-from-CA,3/FR-from-00} |
| 54 |
\sankeyfork{GB} |
| 55 |
{1/GB-from-BR,1/GB-from-MX,5/GB-from-US,1/GB-from-CA,3/GB-from-00} |
| 56 |
\sankeyfork{SP}{1/SP-from-BR,5/SP-from-MX,1/SP-from-US} |
| 57 |
\sankeyfork{PT}{5/PT-from-BR,1/PT-from-MX,1/PT-from-US,1/PT-from-CA} |
| 58 |
|
| 59 |
\foreach \country in {FR,GB,SP,PT}{ |
| 60 |
\sankeyadvance[color=\country]{\country}{\hwidth} |
| 61 |
} |
| 62 |
|
| 63 |
\sankeyfork{FR}{1/FR-to-ZA,1/FR-to-AO,3/FR-to-MA,3/FR-to-SN,3/FR-to-ML} |
| 64 |
\sankeyfork{GB}{7/GB-to-ZA,1/GB-to-AO,2/GB-to-MA,1/GB-to-SN} |
| 65 |
\sankeyfork{SP}{1/SP-to-ZA,3/SP-to-MA,1/SP-to-SN,2/SP-to-00} |
| 66 |
\sankeyfork{PT}{3/PT-to-ZA,2/PT-to-AO,1/PT-to-MA,1/PT-to-SN,1/PT-to-00} |
| 67 |
|
| 68 |
\sankeynode{name=ML,quantity=9, |
| 69 |
at={[xshift=\hdist]FR.right},anchor=right} |
| 70 |
\sankeynode{name=SN,quantity=9, |
| 71 |
at={[yshift=\vdist]ML.left},anchor=right} |
| 72 |
\sankeynode{name=MA,quantity=9, |
| 73 |
at={[yshift=\vdist]SN.left},anchor=right} |
| 74 |
\sankeynode{name=AO,quantity=9, |
| 75 |
at={[yshift=\vdist]MA.left},anchor=right} |
| 76 |
\sankeynode{name=ZA,quantity=12, |
| 77 |
at={[yshift=\vdist]AO.left},anchor=right} |
| 78 |
|
| 79 |
\sankeyfork{ML}{3/ML-from-FR,6/Mail-from-00} |
| 80 |
\sankeyfork{SN} |
| 81 |
{1/SN-from-PT,1/SN-from-SP,1/SN-from-GB,3/SN-from-FR,3/SN-from-00} |
| 82 |
\sankeyfork{MA}{1/MA-from-PT,3/MA-from-SP,2/MA-from-GB,3/MA-from-FR} |
| 83 |
\sankeyfork{AO}{2/AO-from-PT,1/AO-from-GB,1/AO-from-FR,5/AO-from-00} |
| 84 |
\sankeyfork{ZA}{3/ZA-from-PT,1/ZA-from-SP,7/ZA-from-GB,1/ZA-from-FR} |
| 85 |
|
| 86 |
\foreach \country in {ML,SN,MA,AO,ZA}{ |
| 87 |
\sankeyadvance[color=\country]{\country}{\hwidth} |
| 88 |
} |
| 89 |
|
| 90 |
\sankeyfork{ML}{5/ML-to-CN,3/ML-to-JP,1/ML-to-IN} |
| 91 |
\sankeyfork{SN}{5/SN-to-CN,3/SN-to-JP,1/SN-to-IN} |
| 92 |
\sankeyfork{MA}{5/MA-to-CN,3/MA-to-JP,1/MA-to-IN} |
| 93 |
\sankeyfork{AO}{5/AO-to-CN,3/AO-to-JP,1/AO-to-IN} |
| 94 |
\sankeyfork{ZA}{5/ZA-to-CN,3/ZA-to-JP,1/ZA-to-IN,3/ZA-to-00} |
| 95 |
|
| 96 |
\sankeynode{name=IN,quantity=5, |
| 97 |
at={[xshift=\hdist]ML.right},anchor=right} |
| 98 |
\sankeynode{name=JP,quantity=15, |
| 99 |
at={[yshift=\vdist]IN.left},anchor=right} |
| 100 |
\sankeynode{name=CN,quantity=25, |
| 101 |
at={[yshift=\vdist]JP.left},anchor=right} |
| 102 |
|
| 103 |
\sankeyfork{IN} |
| 104 |
{1/IN-from-ZA,1/IN-from-AO,1/IN-from-MA,1/IN-from-SN,1/IN-from-ML} |
| 105 |
\sankeyfork{JP} |
| 106 |
{3/JP-from-ZA,3/JP-from-AO,3/JP-from-MA,3/JP-from-SN,3/JP-from-ML} |
| 107 |
\sankeyfork{CN} |
| 108 |
{5/CN-from-ZA,5/CN-from-AO,5/CN-from-MA,5/CN-from-SN,5/CN-from-ML} |
| 109 |
|
| 110 |
\foreach \country in {IN,JP,CN}{ |
| 111 |
\sankeyadvance[color=\country]{\country}{\hwidth} |
| 112 |
} |
| 113 |
|
| 114 |
\foreach \startcountry/\countries in { |
| 115 |
CA/{PT,GB,FR}, US/{PT,SP,GB,FR}, MX/{PT,SP,GB,FR}, |
| 116 |
BR/{PT,SP,GB,FR}, FR/{ML,SN,MA,AO,ZA}, GB/{SN,MA,AO,ZA}, |
| 117 |
SP/{SN,MA,ZA}, PT/{SN,MA,AO,ZA}, ML/{IN,JP,CN}, |
| 118 |
SN/{IN,JP,CN}, MA/{IN,JP,CN}, AO/{IN,JP,CN}, |
| 119 |
ZA/{IN,JP,CN}} |
| 120 |
{ |
| 121 |
\foreach \endcountry in \countries { |
| 122 |
\sankeyoutin[shade={\startcountry}{\endcountry}] |
| 123 |
{\startcountry-to-\endcountry}{\endcountry-from-\startcountry} |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
\foreach \country/\countryname in {CA/Canada, US/USA, MX/Mexico, |
| 128 |
BR/Brazil, FR/France, GB/England, SP/Spain, PT/Portugal} |
| 129 |
{ |
| 130 |
\node[anchor=west,inner sep=.1em,font=\small] |
| 131 |
at (\country) {\countryname\vphantom{Ag}}; |
| 132 |
} |
| 133 |
|
| 134 |
\foreach \country/\countryname in { |
| 135 |
ML/Mali, SN/Senegal, MA/Morocco, AO/Angola, |
| 136 |
ZA/South Africa, IN/India, JP/Japan, CN/China} |
| 137 |
{ |
| 138 |
\node[anchor=east,inner sep=.1em,font=\small] |
| 139 |
at (\country-old) {\countryname\vphantom{Ag}}; |
| 140 |
} |
| 141 |
\end{sankeydiagram} |
| 142 |
\end{tikzpicture} |