From 016c558d77c197002aef391ab110c47cd575d4df Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Wed, 1 May 2019 18:49:34 +0200 Subject: [PATCH] Try to detect, if one wants to plot vectors with different scale vectors into the same graph. Issue a warning and skip the plot command. --- src/frontend/plotting/plotit.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/frontend/plotting/plotit.c b/src/frontend/plotting/plotit.c index 98336b2ff..f280cdee8 100644 --- a/src/frontend/plotting/plotit.c +++ b/src/frontend/plotting/plotit.c @@ -898,6 +898,17 @@ plotit(wordlist *wl, char *hcopy, char *devname) if (ylim) tfree(ylim); + /* Sanity check: scale and vector may differ, if user assembles a single graph from different plots */ + if(!oneval) { + int firstscalelength = vecs->v_scale->v_length; + for (d = vecs; d; d = d->v_link2) + if (firstscalelength != d->v_length) { + fprintf(cp_err, "\nError: length of vector %s and its scale differ.\n", d->v_name); + fprintf(cp_err, " cannot plot!\n"); + goto quit; + } + } + /* We don't want to try to deal with smith plots for asciiplot. */ if (devname && eq(devname, "lpr")) { /* check if we should (can) linearize */