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

Function CopyXYs

plot/data.go:150–166  ·  view source on GitHub ↗

CopyXYs returns an XYs that is a copy of the x and y values from an XYer, or an error if one of the data points contains a NaN or Infinity.

(data XYer)

Source from the content-addressed store, hash-verified

148// an XYer, or an error if one of the data points contains a NaN or
149// Infinity.
150func CopyXYs(data XYer) (XYs, error) {
151 if data.Len() == 0 {
152 return nil, ErrNoData
153 }
154 cpy := make(XYs, 0, data.Len())
155 for i := range data.Len() {
156 x, y := data.XY(i)
157 if CheckNaNs(x, y) {
158 continue
159 }
160 if err := CheckFloats(x, y); err != nil {
161 return nil, err
162 }
163 cpy = append(cpy, math32.Vec2(x, y))
164 }
165 return cpy, nil
166}
167
168// PlotXYs returns plot coordinates for given set of XYs
169func PlotXYs(plt *Plot, data XYs) XYs {

Callers 5

NewLineFunction · 0.92
NewScatterFunction · 0.92
NewLabelsFunction · 0.92
NewYErrorBarsFunction · 0.92
NewXErrorBarsFunction · 0.92

Calls 5

Vec2Function · 0.92
CheckNaNsFunction · 0.85
CheckFloatsFunction · 0.85
LenMethod · 0.65
XYMethod · 0.65

Tested by

no test coverage detected