()
| 37 | } |
| 38 | |
| 39 | func Example_volcano() { |
| 40 | var levels []float64 |
| 41 | for l := 100.5; l < mat.Max(volcano.Matrix.(*mat.Dense)); l += 5 { |
| 42 | levels = append(levels, l) |
| 43 | } |
| 44 | c := plotter.NewContour(volcano, levels, palette.Rainbow(len(levels), (palette.Yellow+palette.Red)/2, palette.Blue, 1, 1, 1)) |
| 45 | quarterStyle := draw.LineStyle{ |
| 46 | Color: color.Black, |
| 47 | Width: vg.Points(0.5), |
| 48 | Dashes: []vg.Length{0.2, 0.4}, |
| 49 | } |
| 50 | halfStyle := draw.LineStyle{ |
| 51 | Color: color.Black, |
| 52 | Width: vg.Points(0.5), |
| 53 | Dashes: []vg.Length{5, 2, 1, 2}, |
| 54 | } |
| 55 | c.LineStyles = append(c.LineStyles, quarterStyle, halfStyle, quarterStyle) |
| 56 | |
| 57 | h := plotter.NewHeatMap(volcano, palette.Heat(len(levels)*2, 1)) |
| 58 | |
| 59 | p := plot.New() |
| 60 | p.Title.Text = "Maunga Whau Volcano" |
| 61 | |
| 62 | p.Add(h) |
| 63 | p.Add(c) |
| 64 | |
| 65 | p.X.Padding = 0 |
| 66 | p.Y.Padding = 0 |
| 67 | _, p.X.Max, _, p.Y.Max = h.DataRange() |
| 68 | |
| 69 | if err := p.Save(10*vg.Centimeter, 10*vg.Centimeter, "testdata/volcano.png"); err != nil { |
| 70 | panic(err) |
| 71 | } |
| 72 | } |
nothing calls this directly
no test coverage detected