summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Grebenshchikov <sgreben@gmail.com>2018-03-30 23:22:07 +0200
committerSergey Grebenshchikov <sgreben@gmail.com>2018-03-30 23:22:07 +0200
commit4b236bb6a079fee625a2ff1d7bb10133abdd1a9a (patch)
tree19cfb26ba773f702d2ceb40d1fe49d18957ff76f
parentd8f478e6cf5d4246ad58512769faa2a89267f06e (diff)
Handle missing y values in scatter plot
-rw-r--r--cmd/jp/scatter.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/jp/scatter.go b/cmd/jp/scatter.go
index 2fdf0e6..6649241 100644
--- a/cmd/jp/scatter.go
+++ b/cmd/jp/scatter.go
@@ -1,6 +1,7 @@
package main
import (
+ "log"
"reflect"
"github.com/sgreben/jp/pkg/data"
@@ -38,6 +39,9 @@ func scatterPlot(xv, yv []reflect.Value, c draw.Canvas) string {
if len(y) > n {
n = len(y)
}
+ if len(y) == 0 {
+ log.Fatal("no valid y values given")
+ }
// If no valid xs are given, use the indices as x values.
if len(x) == 0 {
x = make([]float64, len(y))