From 125600db9f3762b47c8a047bacbbb984dbd3801e Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 27 Jan 2019 14:23:32 +0100 Subject: [PATCH] take the plot data vector from the node selected - not the current plot This is safe against plots or vectors that are not available. Patch provided by Toni (astx) --- src/frontend/evaluate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/frontend/evaluate.c b/src/frontend/evaluate.c index bdb8648dd..b335d3488 100644 --- a/src/frontend/evaluate.c +++ b/src/frontend/evaluate.c @@ -878,7 +878,13 @@ apply_func(struct func *func, struct pnode *arg) fprintf(cp_err, "Error: bad v() syntax\n"); return (NULL); } - t = vec_fromplot(arg->pn_value->v_name, get_plot(arg->pn_value->v_plot->pl_typename)); + /* function 'v': take the plot data vector from the node selected - not the current plot */ + if (func->fu_name && eq(func->fu_name, "v")) { + t = arg->pn_value; + } + else { + t = vec_fromplot(arg->pn_value->v_name, plot_cur); + } if (!t) { fprintf(cp_err, "Error: no such vector %s\n", arg->pn_value->v_name); return (NULL);