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

Function TestHeatMapWithContour

plotter/contour_test.go:44–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

42}
43
44func TestHeatMapWithContour(t *testing.T) {
45 if !*visualDebug {
46 return
47 }
48 m := unitGrid{mat.NewDense(3, 4, []float64{
49 2, 1, 4, 3,
50 6, 7, 2, 5,
51 9, 10, 11, 12,
52 })}
53 h := NewHeatMap(m, palette.Heat(12, 1))
54
55 levels := []float64{1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5}
56 c := NewContour(m, levels, palette.Rainbow(10, palette.Blue, palette.Red, 1, 1, 1))
57 c.LineStyles[0].Width *= 5
58
59 plt := plot.New()
60 plt.Add(h)
61 plt.Add(c)
62 plt.Add(NewGlyphBoxes())
63
64 plt.X.Padding = 0
65 plt.Y.Padding = 0
66 plt.X.Max = 3.5
67 plt.Y.Max = 2.5
68
69 err := plt.Save(7*vg.Centimeter, 7*vg.Centimeter, "heat.svg")
70 if err != nil {
71 t.Fatalf("could not save plot: %+v", err)
72 }
73}
74
75func TestComplexContours(t *testing.T) {
76 rnd := rand.New(rand.NewPCG(1, 1))

Callers

nothing calls this directly

Calls 8

HeatFunction · 0.92
RainbowFunction · 0.92
NewFunction · 0.92
NewHeatMapFunction · 0.85
NewContourFunction · 0.85
NewGlyphBoxesFunction · 0.85
SaveMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected