Browse Source

new flag 'digitop' for the 'plot' command:

Plot digital (event nodes) vertically, separated by 0.1
The grid is adapted acordingly.
set xbrushwidth=3 will yield good results.
pre-master-46
Holger Vogt 4 years ago
parent
commit
917dab9da7
  1. 26
      src/frontend/plotting/plotit.c

26
src/frontend/plotting/plotit.c

@ -287,7 +287,7 @@ bool plotit(wordlist *wl, const char *hcopy, const char *devname)
static GRIDTYPE gtype = GRID_LIN;
static PLOTTYPE ptype = PLOT_LIN;
bool gfound = FALSE, pfound = FALSE, oneval = FALSE, contour2d = FALSE;
bool gfound = FALSE, pfound = FALSE, oneval = FALSE, contour2d = FALSE, digitop = FALSE;
double ylims[2], xlims[2];
struct pnode *pn, *names = NULL;
struct dvec *d = NULL, *vecs = NULL, *lv = NULL, *lastvs = NULL;
@ -365,6 +365,8 @@ bool plotit(wordlist *wl, const char *hcopy, const char *devname)
contour2d = getflag(wl, "xycontour");
/* Now extract all the parameters. */
digitop = getflag(wl, "digitop");
sameflag = getflag(wl, "samep");
if (!sameflag || !xlim) {
@ -850,6 +852,28 @@ bool plotit(wordlist *wl, const char *hcopy, const char *devname)
}
}
/* Add n * 1.1 to digital event node based vectors */
if (digitop) {
double spacing = 1.0999999; /* numerical precision: stay below (rounded) ymax */
double nn = 0.;
int ii = 0;
for (d = vecs; d; d = d->v_link2) {
if (d->v_scale && eq(d->v_scale->v_name, "step") && (d->v_scale->v_type == SV_TIME) && (d->v_type == SV_VOLTAGE)) {
for (ii = 0; ii < d->v_length; ii++) {
d->v_realdata[ii] += nn;
}
nn += spacing;
}
}
if (!ydelta)
ydelta = TMALLOC(double, 1);
*ydelta = spacing;
if (!ylim)
ylim = TMALLOC(double, 2);
ylim[0] = 0;
ylim[1] = nn;
}
/* If there are higher dimensional vectors, transform them into a
* family of vectors.
*/

Loading…
Cancel
Save