avoid retrace in output graph by adding label 'noretraceplot'

to the plot command, that creates a lin plot trying to avoid retracing
This commit is contained in:
h_vogt 2016-09-09 22:04:00 +02:00 committed by Holger Vogt
parent 611596c916
commit d4adb027d2
4 changed files with 14 additions and 3 deletions

View File

@ -267,7 +267,7 @@ gr_point(struct dvec *dv,
switch (currentgraph->plottype) { switch (currentgraph->plottype) {
double *tics; double *tics;
case PLOT_LIN: case PLOT_LIN:
case PLOT_MONOLIN:
/* If it's a linear plot, ignore first point since we don't /* If it's a linear plot, ignore first point since we don't
want to connect with oldx and oldy. */ want to connect with oldx and oldy. */
if (np) if (np)

View File

@ -130,6 +130,7 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart)
* interpolation. * interpolation.
*/ */
if ((degree == 1) && (gridsize == 0)) { if ((degree == 1) && (gridsize == 0)) {
bool mono = (currentgraph->plottype == PLOT_MONOLIN);
dir = 0; dir = 0;
for (i = 0, j = v->v_length; i < j; i++) { for (i = 0, j = v->v_length; i < j; i++) {
dx = isreal(xs) ? xs->v_realdata[i] : dx = isreal(xs) ? xs->v_realdata[i] :
@ -137,7 +138,7 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart)
dy = isreal(v) ? v->v_realdata[i] : dy = isreal(v) ? v->v_realdata[i] :
realpart(v->v_compdata[i]); realpart(v->v_compdata[i]);
if ((i == 0 || (dir > 0 ? lx > dx : dir < 0 ? lx < dx : 0)) && if ((i == 0 || (dir > 0 ? lx > dx : dir < 0 ? lx < dx : 0)) &&
xs->v_plot && xs->v_plot->pl_scale == xs) (mono || (xs->v_plot && xs->v_plot->pl_scale == xs)))
{ {
gr_point(v, dx, dy, lx, ly, 0); gr_point(v, dx, dy, lx, ly, 0);
} else { } else {

View File

@ -454,6 +454,14 @@ plotit(wordlist *wl, char *hcopy, char *devname)
pfound = TRUE; pfound = TRUE;
} }
} }
if (getflag(wl, "noretraceplot")) {
if (pfound) {
fprintf(cp_err, "Warning: too many plot types given\n");
} else {
ptype = PLOT_MONOLIN;
pfound = TRUE;
}
}
if (getflag(wl, "combplot")) { if (getflag(wl, "combplot")) {
if (pfound) { if (pfound) {
fprintf(cp_err, "Warning: too many plot types given\n"); fprintf(cp_err, "Warning: too many plot types given\n");
@ -475,6 +483,8 @@ plotit(wordlist *wl, char *hcopy, char *devname)
if (cp_getvar("plotstyle", CP_STRING, buf)) { if (cp_getvar("plotstyle", CP_STRING, buf)) {
if (eq(buf, "linplot")) if (eq(buf, "linplot"))
ptype = PLOT_LIN; ptype = PLOT_LIN;
else if (eq(buf, "noretraceplot"))
ptype = PLOT_MONOLIN;
else if (eq(buf, "combplot")) else if (eq(buf, "combplot"))
ptype = PLOT_COMB; ptype = PLOT_COMB;
else if (eq(buf, "pointplot")) else if (eq(buf, "pointplot"))

View File

@ -20,7 +20,7 @@ enum dvec_flags {
/* Plot types. */ /* Plot types. */
typedef enum { typedef enum {
PLOT_LIN, PLOT_COMB, PLOT_POINT PLOT_LIN, PLOT_COMB, PLOT_POINT, PLOT_MONOLIN
} PLOTTYPE; } PLOTTYPE;