MCPcopy Index your code
hub / github.com/gonum/plot / ExampleSankey_grouped

Function ExampleSankey_grouped

plotter/sankey_example_test.go:144–407  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

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.
144func 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,

Callers

nothing calls this directly

Calls 14

StockRangeMethod · 0.95
ThumbnailersMethod · 0.95
WriteToMethod · 0.95
NewFunction · 0.92
NewFunction · 0.92
PointsFunction · 0.92
NewFunction · 0.92
NewSankeyFunction · 0.92
NewGlyphBoxesFunction · 0.92
TransformsMethod · 0.80
NominalXMethod · 0.80
DrawMethod · 0.65

Tested by

no test coverage detected