private void validate() {
        boolean ok = true;
        if (x.length != y.length || x.length < 3) {
            ok = false;
        }
        for (int i = 0; i < x.length - 1 && ok; i++) {
            if (x[i] >= x[i + 1] || Double.isNaN(y[i])) {
                ok = false;
            }
        }
        if (!ok) {
            throw new IllegalArgumentException("Invalid plottable data supplied");
        }
    }