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

Function Example_volcano

plotter/volcano_example_test.go:39–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37}
38
39func 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}

Callers

nothing calls this directly

Calls 10

DataRangeMethod · 0.95
NewContourFunction · 0.92
RainbowFunction · 0.92
PointsFunction · 0.92
NewHeatMapFunction · 0.92
HeatFunction · 0.92
NewFunction · 0.92
SaveMethod · 0.80
MaxMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected