MCPcopy Create free account
hub / github.com/cogentcore/core / TestScatter

Function TestScatter

plot/plots/plot_test.go:83–113  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

81}
82
83func TestScatter(t *testing.T) {
84 pt := plot.New()
85 pt.Title.Text = "Test Scatter"
86 pt.X.Min = 0
87 pt.X.Max = 100
88 pt.X.Label.Text = "X Axis"
89 pt.Y.Min = 0
90 pt.Y.Max = 100
91 pt.Y.Label.Text = "Y Axis"
92
93 data := make(plot.XYs, 21)
94 for i := range data {
95 data[i].X = float32(i * 5)
96 data[i].Y = float32(50) + 40*math32.Sin((float32(i)/8)*math32.Pi)
97 }
98
99 l1, err := NewScatter(data)
100 if err != nil {
101 t.Error(err.Error())
102 }
103 pt.Add(l1)
104
105 pt.Resize(image.Point{640, 480})
106
107 shs := ShapesValues()
108 for _, sh := range shs {
109 l1.PointShape = sh
110 pt.Draw()
111 imagex.Assert(t, pt.Pixels, "scatter-"+sh.String()+".png")
112 }
113}
114
115func TestLabels(t *testing.T) {
116 pt := plot.New()

Callers

nothing calls this directly

Calls 10

NewFunction · 0.92
SinFunction · 0.92
AssertFunction · 0.92
NewScatterFunction · 0.85
ShapesValuesFunction · 0.85
ErrorMethod · 0.65
AddMethod · 0.65
DrawMethod · 0.65
StringMethod · 0.65
ResizeMethod · 0.45

Tested by

no test coverage detected