ExampleSankey_grouped creates a sankey diagram with grouped flows. The output can be found at https://github.com/gonum/plot/blob/master/plotter/testdata/sankeyGrouped_golden.png.
()
| 142 | // ExampleSankey_grouped creates a sankey diagram with grouped flows. |
| 143 | // The output can be found at https://github.com/gonum/plot/blob/master/plotter/testdata/sankeyGrouped_golden.png. |
| 144 | func ExampleSankey_grouped() { |
| 145 | p := plot.New() |
| 146 | c := vgimg.New(vg.Points(300), vg.Points(180)) |
| 147 | dc := draw.New(c) |
| 148 | |
| 149 | // Define the stock categories |
| 150 | const ( |
| 151 | treeType int = iota |
| 152 | consumer |
| 153 | fate |
| 154 | ) |
| 155 | categoryLabels := []string{"Tree type", "Consumer", "Fate"} |
| 156 | |
| 157 | flows := []plotter.Flow{ |
| 158 | { |
| 159 | SourceCategory: treeType, |
| 160 | SourceLabel: "LargeLargeLargeLargeLargeLargeLargeLargeLarge", |
| 161 | ReceptorCategory: consumer, |
| 162 | ReceptorLabel: "Mohamed", |
| 163 | Group: "Apples", |
| 164 | Value: 5, |
| 165 | }, |
| 166 | { |
| 167 | SourceCategory: treeType, |
| 168 | SourceLabel: "LargeLargeLargeLargeLargeLargeLargeLargeLarge", |
| 169 | ReceptorCategory: consumer, |
| 170 | ReceptorLabel: "Mohamed", |
| 171 | Group: "Dates", |
| 172 | Value: 3, |
| 173 | }, |
| 174 | { |
| 175 | SourceCategory: treeType, |
| 176 | SourceLabel: "Small", |
| 177 | ReceptorCategory: consumer, |
| 178 | ReceptorLabel: "Mohamed", |
| 179 | Group: "Lychees", |
| 180 | Value: 2, |
| 181 | }, |
| 182 | { |
| 183 | SourceCategory: treeType, |
| 184 | SourceLabel: "LargeLargeLargeLargeLargeLargeLargeLargeLarge", |
| 185 | ReceptorCategory: consumer, |
| 186 | ReceptorLabel: "Sofia", |
| 187 | Group: "Apples", |
| 188 | Value: 3, |
| 189 | }, |
| 190 | { |
| 191 | SourceCategory: treeType, |
| 192 | SourceLabel: "LargeLargeLargeLargeLargeLargeLargeLargeLarge", |
| 193 | ReceptorCategory: consumer, |
| 194 | ReceptorLabel: "Sofia", |
| 195 | Group: "Dates", |
| 196 | Value: 4, |
| 197 | }, |
| 198 | { |
| 199 | SourceCategory: treeType, |
| 200 | SourceLabel: "Small", |
| 201 | ReceptorCategory: consumer, |
nothing calls this directly
no test coverage detected