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)
| 148 | // an XYer, or an error if one of the data points contains a NaN or |
| 149 | // Infinity. |
| 150 | func 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 |
| 169 | func PlotXYs(plt *Plot, data XYs) XYs { |
no test coverage detected