MCPcopy Index your code
hub / github.com/gonum/plot / NewField

Function NewField

plotter/field.go:66–85  ·  view source on GitHub ↗

NewField creates a new vector field plotter.

(f FieldXY)

Source from the content-addressed store, hash-verified

64
65// NewField creates a new vector field plotter.
66func NewField(f FieldXY) *Field {
67 max := math.Inf(-1)
68 c, r := f.Dims()
69 for i := range c {
70 for j := range r {
71 v := f.Vector(i, j)
72 d := math.Hypot(v.X, v.Y)
73 if math.IsNaN(d) {
74 continue
75 }
76 max = math.Max(max, d)
77 }
78 }
79
80 return &Field{
81 FieldXY: f,
82 LineStyle: DefaultLineStyle,
83 max: max,
84 }
85}
86
87// Plot implements the Plot method of the plot.Plotter interface.
88func (f *Field) Plot(c draw.Canvas, plt *plot.Plot) {

Callers 4

TestFieldDimsFunction · 0.92
ExampleFieldFunction · 0.92
ExampleField_colorsFunction · 0.92
ExampleField_gophersFunction · 0.92

Calls 3

DimsMethod · 0.65
VectorMethod · 0.65
MaxMethod · 0.65

Tested by 4

TestFieldDimsFunction · 0.74
ExampleFieldFunction · 0.74
ExampleField_colorsFunction · 0.74
ExampleField_gophersFunction · 0.74