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

Function TestSingletonHistogram

plotter/histogram_test.go:21–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19}
20
21func TestSingletonHistogram(t *testing.T) {
22 done := make(chan struct{}, 1)
23 go func() {
24 defer close(done)
25 p := plot.New()
26 hist, err := plotter.NewHist(plotter.Values([]float64{1.0}), 60)
27 if err != nil {
28 t.Errorf("unexpected error from NewHist: %v", err)
29 return
30 }
31 hist.Normalize(1)
32
33 p.Add(hist)
34
35 _, err = p.WriterTo(4*vg.Inch, 4*vg.Inch, "png")
36 if err != nil {
37 t.Errorf("unexpected error from WriterTo: %v", err)
38 return
39 }
40 }()
41
42 select {
43 case <-time.After(10 * time.Second):
44 t.Error("histogram timed out")
45 case <-done:
46 }
47}
48func TestHistogramLogScale(t *testing.T) {
49 cmpimg.CheckPlot(ExampleHistogram_logScaleY, t, "histogram_logy.png")
50}

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
NewHistFunction · 0.92
ValuesTypeAlias · 0.92
WriterToMethod · 0.80
NormalizeMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected