FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
plot/plotter/general_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
/
general_example_test.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
66 lines (56 loc) · 1.59 KB
Breadcrumbs
plot
/
plotter
/
general_example_test.go
Copy path
File metadata and controls
66 lines (56 loc) · 1.59 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
59
60
61
62
63
64
65
66
// 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
plotter_test
import
(
"log"
"gonum.org/v1/plot"
"gonum.org/v1/plot/plotter"
"gonum.org/v1/plot/vg"
)
// Draw the plot logo.
func
Example
() {
p
:=
plot
.
New
()
plotter
.
DefaultLineStyle
.
Width
=
vg
.
Points
(
1
)
plotter
.
DefaultGlyphStyle
.
Radius
=
vg
.
Points
(
3
)
p
.
Y
.
Tick
.
Marker
=
plot
.
ConstantTicks
([]plot.
Tick
{
{
Value
:
0
,
Label
:
"0"
}, {
Value
:
0.25
,
Label
:
""
}, {
Value
:
0.5
,
Label
:
"0.5"
}, {
Value
:
0.75
,
Label
:
""
}, {
Value
:
1
,
Label
:
"1"
},
})
p
.
X
.
Tick
.
Marker
=
plot
.
ConstantTicks
([]plot.
Tick
{
{
Value
:
0
,
Label
:
"0"
}, {
Value
:
0.25
,
Label
:
""
}, {
Value
:
0.5
,
Label
:
"0.5"
}, {
Value
:
0.75
,
Label
:
""
}, {
Value
:
1
,
Label
:
"1"
},
})
pts
:=
plotter.
XYs
{{
X
:
0
,
Y
:
0
}, {
X
:
0
,
Y
:
1
}, {
X
:
0.5
,
Y
:
1
}, {
X
:
0.5
,
Y
:
0.6
}, {
X
:
0
,
Y
:
0.6
}}
line
,
err
:=
plotter
.
NewLine
(
pts
)
if
err
!=
nil
{
log
.
Panic
(
err
)
}
scatter
,
err
:=
plotter
.
NewScatter
(
pts
)
if
err
!=
nil
{
log
.
Panic
(
err
)
}
p
.
Add
(
line
,
scatter
)
pts
=
plotter.
XYs
{{
X
:
1
,
Y
:
0
}, {
X
:
0.75
,
Y
:
0
}, {
X
:
0.75
,
Y
:
0.75
}}
line
,
err
=
plotter
.
NewLine
(
pts
)
if
err
!=
nil
{
log
.
Panic
(
err
)
}
scatter
,
err
=
plotter
.
NewScatter
(
pts
)
if
err
!=
nil
{
log
.
Panic
(
err
)
}
p
.
Add
(
line
,
scatter
)
pts
=
plotter.
XYs
{{
X
:
0.5
,
Y
:
0.5
}, {
X
:
1
,
Y
:
0.5
}}
line
,
err
=
plotter
.
NewLine
(
pts
)
if
err
!=
nil
{
log
.
Panic
(
err
)
}
scatter
,
err
=
plotter
.
NewScatter
(
pts
)
if
err
!=
nil
{
log
.
Panic
(
err
)
}
p
.
Add
(
line
,
scatter
)
err
=
p
.
Save
(
100
,
100
,
"testdata/plotLogo.png"
)
if
err
!=
nil
{
log
.
Panic
(
err
)
}
}
Back
|
FazBrowse Home
|
New Git URL