FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
plot/plotutil/errorpoints_example_test.go at master · Akasan/plot · GitHub
Akasan
plot
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
plot
/
plotutil
/
errorpoints_example_test.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
58 lines (50 loc) · 1.27 KB
Breadcrumbs
plot
/
plotutil
/
errorpoints_example_test.go
Copy path
File metadata and controls
58 lines (50 loc) · 1.27 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
// Copyright ©2015 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
plotutil_test
import
(
"math/rand/v2"
"gonum.org/v1/plot"
"gonum.org/v1/plot/plotter"
"gonum.org/v1/plot/plotutil"
)
func
ExampleErrorPoints
() {
rnd
:=
rand
.
New
(
rand
.
NewPCG
(
1
,
1
))
// Get some random data.
n
,
m
:=
5
,
10
pts
:=
make
([]plotter.
XYer
,
n
)
for
i
:=
range
pts
{
xys
:=
make
(plotter.
XYs
,
m
)
pts
[
i
]
=
xys
center
:=
float64
(
i
)
for
j
:=
range
xys
{
xys
[
j
].
X
=
center
+
(
rnd
.
Float64
()
-
0.5
)
xys
[
j
].
Y
=
center
+
(
rnd
.
Float64
()
-
0.5
)
}
}
plt
:=
plot
.
New
()
mean95
,
err
:=
plotutil
.
NewErrorPoints
(
plotutil
.
MeanAndConf95
,
pts
...
)
if
err
!=
nil
{
panic
(
err
)
}
medMinMax
,
err
:=
plotutil
.
NewErrorPoints
(
plotutil
.
MedianAndMinMax
,
pts
...
)
if
err
!=
nil
{
panic
(
err
)
}
err
=
plotutil
.
AddLinePoints
(
plt
,
"mean and 95% confidence"
,
mean95
,
"median and minimum and maximum"
,
medMinMax
)
if
err
!=
nil
{
panic
(
err
)
}
if
err
:=
plotutil
.
AddErrorBars
(
plt
,
mean95
,
medMinMax
);
err
!=
nil
{
panic
(
err
)
}
if
err
:=
plotutil
.
AddScatters
(
plt
,
pts
[
0
],
pts
[
1
],
pts
[
2
],
pts
[
3
],
pts
[
4
]);
err
!=
nil
{
panic
(
err
)
}
err
=
plt
.
Save
(
4
,
4
,
"centroids.png"
)
if
err
!=
nil
{
panic
(
err
)
}
}
Back
|
FazBrowse Home
|
New Git URL