static int _pgqci (void) { int i; cpgqci(&i); return i; }
void plot(g_ctl * ctl, float *y, int npts, float delta, float b, int overlay, int color, float zoom) { float *x = NULL; int i; int oldcolor; cpgqci(&oldcolor); x = malloc(sizeof(float) * npts); for (i = 0; i < npts; i++) x[i] = i * delta + b; if (!overlay) { ctl_yupdate_ndb(ctl, y, npts, delta, b); ctl->ymin /= zoom; ctl->ymax /= zoom; ctl->h = ctl->ymax - ctl->ymin; ctl_resizeview(ctl); ctl_drawaxis(ctl); } cpgsci(color); cpgline(npts, x, y); cpgsci(oldcolor); x = io_freeData(x); }
void mark(g_ctl * ctl, float x, char *c, int color) { int oldcolor; cpgqci(&oldcolor); cpgsci(color); cpgmove(x, ctl->ymin + ctl->h * 0.05); cpgdraw(x, ctl->ymax - ctl->h * 0.05); cpgptxt(x, ctl->ymin + ctl->h * 0.1, 0.0, -0.05, c); cpgsci(oldcolor); }