FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
plot/plotter/filledLine_example_test.go at master · gonum/plot · GitHub
gonum
/
plot
Public
Notifications
You must be signed in to change notification settings
Fork
202
Star
3k
Code
Issues
86
Pull requests
6
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
plot
/
plotter
/
filledLine_example_test.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
53 lines (44 loc) · 1.11 KB
Breadcrumbs
plot
/
plotter
/
filledLine_example_test.go
Copy path
File metadata and controls
53 lines (44 loc) · 1.11 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
// Copyright ©2018 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_test
import
(
"image/color"
"log"
"math/rand/v2"
"runtime"
"gonum.org/v1/plot"
"gonum.org/v1/plot/plotter"
)
func
ExampleLine_filledLine
() {
rnd
:=
rand
.
New
(
rand
.
NewPCG
(
1
,
1
))
// randomPoints returns some random x, y points
// with some interesting kind of trend.
randomPoints
:=
func
(
n
int
,
x
float64
) plotter.
XYs
{
pts
:=
make
(plotter.
XYs
,
n
)
for
i
:=
range
pts
{
if
i
==
0
{
pts
[
i
].
X
=
x
+
rnd
.
Float64
()
}
else
{
pts
[
i
].
X
=
pts
[
i
-
1
].
X
+
0.5
+
rnd
.
Float64
()
}
pts
[
i
].
Y
=
-
5.
+
10
*
rnd
.
Float64
()
}
return
pts
}
p
:=
plot
.
New
()
p
.
Title
.
Text
=
"Filled Line Example"
p
.
X
.
Label
.
Text
=
"X"
p
.
Y
.
Label
.
Text
=
"Y"
p
.
Add
(
plotter
.
NewGrid
())
filled
,
err
:=
plotter
.
NewLine
(
randomPoints
(
4
,
0
))
if
err
!=
nil
{
log
.
Panic
(
err
)
}
filled
.
FillColor
=
color.
RGBA
{
R
:
196
,
G
:
255
,
B
:
196
,
A
:
255
}
p
.
Add
(
filled
)
err
=
p
.
Save
(
200
,
200
,
"testdata/filledLine_"
+
runtime
.
GOARCH
+
".png"
)
if
err
!=
nil
{
log
.
Panic
(
err
)
}
}
Back
|
FazBrowse Home
|
New Git URL