MCPcopy Create free account
hub / github.com/gonum/plot / TestHeatMapDims

Function TestHeatMapDims

plotter/heat_test.go:58–89  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

56}
57
58func TestHeatMapDims(t *testing.T) {
59 pal := palette.Heat(12, 1)
60
61 for _, test := range []struct {
62 rows int
63 cols int
64 }{
65 {rows: 1, cols: 2},
66 {rows: 2, cols: 1},
67 {rows: 2, cols: 2},
68 } {
69 func() {
70 defer func() {
71 r := recover()
72 if r != nil {
73 t.Errorf("unexpected panic for rows=%d cols=%d: %v", test.rows, test.cols, r)
74 }
75 }()
76
77 m := offsetUnitGrid{Data: mat.NewDense(test.rows, test.cols, nil)}
78 h := plotter.NewHeatMap(m, pal)
79
80 p := plot.New()
81 p.Add(h)
82
83 img := vgimg.New(250, 175)
84 dc := draw.New(img)
85
86 p.Draw(dc)
87 }()
88 }
89}
90
91func TestRasterHeatMap(t *testing.T) {
92 cmpimg.CheckPlot(ExampleHeatMap_rasterized, t, "rasterHeatMap.png")

Callers

nothing calls this directly

Calls 7

HeatFunction · 0.92
NewHeatMapFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
DrawMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected