-
Notifications
You must be signed in to change notification settings - Fork 204
/
colorbar_test.go
59 lines (50 loc) · 1.2 KB
/
colorbar_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright ©2017 The gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package plotter
import (
"log"
"testing"
"github.com/gonum/plot"
"github.com/gonum/plot/internal/cmpimg"
"github.com/gonum/plot/palette/moreland"
)
func ExampleColorBar_horizontal() {
p, err := plot.New()
if err != nil {
log.Panic(err)
}
cm := moreland.ExtendedBlackBody()
cm.SetMax(1)
l := NewColorBar(cm)
p.Add(l)
p.HideY()
p.X.Padding = 0
p.Title.Text = "Title"
if err = p.Save(300, 48, "testdata/colorBarHorizontal.png"); err != nil {
log.Panic(err)
}
}
func TestColorBar_horizontal(t *testing.T) {
cmpimg.CheckPlot(ExampleColorBar_horizontal, t, "colorBarHorizontal.png")
}
func ExampleColorBar_vertical() {
p, err := plot.New()
if err != nil {
log.Panic(err)
}
cm := moreland.ExtendedBlackBody()
cm.SetMax(1)
l := NewColorBar(cm)
l.Vertical = true
p.Add(l)
p.HideX()
p.Y.Padding = 0
p.Title.Text = "Title"
if err = p.Save(40, 300, "testdata/colorBarVertical.png"); err != nil {
log.Panic(err)
}
}
func TestColorBar_vertical(t *testing.T) {
cmpimg.CheckPlot(ExampleColorBar_vertical, t, "colorBarVertical.png")
}