Example_errpoints draws some error points.
()
| 73 | |
| 74 | // Example_errpoints draws some error points. |
| 75 | func Example_errpoints() *plot.Plot { |
| 76 | rnd := rand.New(rand.NewPCG(1, 1)) |
| 77 | |
| 78 | // Get some random data. |
| 79 | n, m := 5, 10 |
| 80 | pts := make([]plotter.XYer, n) |
| 81 | for i := range pts { |
| 82 | xys := make(plotter.XYs, m) |
| 83 | pts[i] = xys |
| 84 | center := float64(i) |
| 85 | for j := range xys { |
| 86 | xys[j].X = center + (rnd.Float64() - 0.5) |
| 87 | xys[j].Y = center + (rnd.Float64() - 0.5) |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | plt := plot.New() |
| 92 | |
| 93 | mean95, err := plotutil.NewErrorPoints(plotutil.MeanAndConf95, pts...) |
| 94 | if err != nil { |
| 95 | panic(err) |
| 96 | } |
| 97 | medMinMax, err := plotutil.NewErrorPoints(plotutil.MedianAndMinMax, pts...) |
| 98 | if err != nil { |
| 99 | panic(err) |
| 100 | } |
| 101 | plotutil.AddLinePoints(plt, |
| 102 | "mean and 95% confidence", mean95, |
| 103 | "median and minimum and maximum", medMinMax) |
| 104 | if err := plotutil.AddErrorBars(plt, mean95, medMinMax); err != nil { |
| 105 | panic(err) |
| 106 | } |
| 107 | if err := plotutil.AddScatters(plt, pts[0], pts[1], pts[2], pts[3], pts[4]); err != nil { |
| 108 | panic(err) |
| 109 | } |
| 110 | |
| 111 | return plt |
| 112 | } |
| 113 | |
| 114 | type stackValues struct{ vs []plotter.Values } |
| 115 |
nothing calls this directly
no test coverage detected