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

Function Example_stackedAreaChart

plotutil/main.go:126–168  ·  view source on GitHub ↗

An example of making a stacked area chart.

()

Source from the content-addressed store, hash-verified

124
125// An example of making a stacked area chart.
126func Example_stackedAreaChart() *plot.Plot {
127 p := plot.New()
128
129 p.Title.Text = "Example: Software Version Comparison"
130 p.X.Label.Text = "Date"
131 p.Y.Label.Text = "Users (in thousands)"
132
133 p.Legend.Top = true
134 p.Legend.Left = true
135
136 vals := []plotter.Values{
137 {0.02, 0.015, 0, 0, 0, 0, 0},
138 {0, 0.48, 0.36, 0.34, 0.32, 0.32, 0.28},
139 {0, 0, 0.87, 1.4, 0.64, 0.32, 0.28},
140 {0, 0, 0, 1.26, 0.34, 0.12, 0.09},
141 {0, 0, 0, 0, 2.48, 2.68, 2.13},
142 {0, 0, 0, 0, 0, 1.32, 0.54},
143 {0, 0, 0, 0, 0, 0.68, 5.67},
144 }
145
146 err := plotutil.AddStackedAreaPlots(p, plotter.Values{2007, 2008, 2009, 2010, 2011, 2012, 2013},
147 "Version 3.0",
148 stackValues{vs: vals[0:7]},
149 "Version 2.1",
150 stackValues{vs: vals[0:6]},
151 "Version 2.0.1",
152 stackValues{vs: vals[0:5]},
153 "Version 2.0",
154 stackValues{vs: vals[0:4]},
155 "Version 1.1",
156 stackValues{vs: vals[0:3]},
157 "Version 1.0",
158 stackValues{vs: vals[0:2]},
159 "Beta",
160 stackValues{vs: vals[0:1]},
161 )
162
163 if err != nil {
164 panic(err)
165 }
166
167 return p
168}

Callers

nothing calls this directly

Calls 2

NewFunction · 0.92
AddStackedAreaPlotsFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…