void plotall(int nlyr, double* T, double* plyr, double* z, double* deltaTday) { #ifndef _NOPLOT /* Plot T against p */ pladv(1); /* select subpage 1 */ plvsta(); /* standard viewport */ plclear(); /* clear subpage */ plcol0 (15); /* color black */ plwind( 0, 400, PSURF, 0 ); /* xmin, xmax, ymin, ymax */ plbox( "bcnst", 100, 0, "bcnst", 150.0, 0 ); pllab ("temperature [K]", "p [hPa]", ""); /* axis labels */ plcol0 (14); /* color blue */ plline (nlyr, T, plyr); /* plot temperature profile */ plcol0 (15); /* color black */ /* Plot T against z */ pladv(3); /* select subpage 1 */ plvsta(); /* standard viewport */ plclear(); /* clear subpage */ plcol0 (15); /* color black */ plwind( 0, 400, 0, 40000 ); /* xmin, xmax, ymin, ymax */ plbox( "bcnst", 100, 0, "bcnst", 5000.0, 0 ); pllab ("temperature [K]", "z [m]", ""); /* axis labels */ plcol0 (14); /* color blue */ plline (nlyr, T, z); /* plot temperature profile */ plcol0 (15); /* color black */ /* Plot Heating rate against p */ pladv(2); /* select subpage 1 */ plvsta(); /* standard viewport */ plclear(); /* clear subpage */ plcol0 (15); /* color black */ plwind( -20, 20, PSURF, 0 ); /* xmin, xmax, ymin, ymax */ plbox( "bcnst", 2, 0, "bcnst", 150.0, 0 ); pllab ("Heating Rate [T/day]", "p [hPa]", ""); /* axis labels */ plcol0 (12); /* color blue */ plline (nlyr, deltaTday, plyr); /* plot temperature profile */ plcol0 (15); /* color black */ /* Plot Heating rate against z */ pladv(4); /* select subpage 1 */ plvsta(); /* standard viewport */ plclear(); /* clear subpage */ plcol0 (15); /* color black */ plwind( -20, 20, 0, 40000 ); /* xmin, xmax, ymin, ymax */ plbox( "bcnst", 2, 0, "bcnst", 5000.0, 0 ); pllab ("Heating Rate [T/day]", "z [m]", ""); /* axis labels */ plcol0 (12); /* color blue */ plline (nlyr, deltaTday, z); /* plot temperature profile */ plcol0 (15); /* color black */ #endif }
static void c_plenvi(PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax, PLINT just, PLINT axis, PLINT old) { PLFLT lb, rb, tb, bb, dx, dy; PLFLT xsize, ysize, size, xscale, yscale, scale; PLFLT spxmin, spxmax, spymin, spymax; PLFLT vpxmin, vpxmax, vpymin, vpymax; if (plsc->level < 1) { plabort("plenv: Please call plinit first"); return; } if (xmin == xmax) { plabort("plenv: Invalid xmin and xmax arguments"); return; } if (ymin == ymax) { plabort("plenv: Invalid ymin and ymax arguments"); return; } if (just < -1 || just > 2) { plabort("plenv: Invalid just option"); return; } if (plsc->nsubx * plsc->nsuby == 1) /* not multiplot mode */ old = 1; if (old == 1) pladv(0); else plclear(); if (just == 0) plvsta(); else if (just == 1){ lb = 8.0 * plsc->chrht; rb = 5.0 * plsc->chrht; tb = 5.0 * plsc->chrht; bb = 5.0 * plsc->chrht; dx = ABS(xmax - xmin); dy = ABS(ymax - ymin); plgspa(&spxmin, &spxmax, &spymin, &spymax); xsize = spxmax - spxmin; ysize = spymax - spymin; xscale = dx / (xsize - lb - rb); yscale = dy / (ysize - tb - bb); scale = MAX(xscale, yscale); vpxmin = MAX(lb, 0.5 * (xsize - dx / scale)); vpxmax = vpxmin + (dx / scale); vpymin = MAX(bb, 0.5 * (ysize - dy / scale)); vpymax = vpymin + (dy / scale); plsvpa(vpxmin, vpxmax, vpymin, vpymax); } else if(just == 2) { lb = 8.0 * plsc->chrht; rb = 5.0 * plsc->chrht; tb = 5.0 * plsc->chrht; bb = 5.0 * plsc->chrht; plgspa(&spxmin, &spxmax, &spymin, &spymax); xsize = spxmax - spxmin; ysize = spymax - spymin; size = MIN(xsize-lb-rb, ysize-tb-bb); dx = (xsize-size-lb-rb)/2; vpxmin = lb + dx; vpxmax = vpxmin + size; dy = (ysize-size-bb-tb)/2; vpymin = bb + dy; vpymax = vpymin + size; plsvpa(vpxmin, vpxmax, vpymin, vpymax); } plwind(xmin, xmax, ymin, ymax); switch (axis) { case -2: break; case -1: plbox("bc", (PLFLT) 0.0, 0, "bc", (PLFLT) 0.0, 0); break; case 0: plbox("bcnst", (PLFLT) 0.0, 0, "bcnstv", (PLFLT) 0.0, 0); break; case 1: plbox("abcnst", (PLFLT) 0.0, 0, "abcnstv", (PLFLT) 0.0, 0); break; case 2: plbox("abcgnst", (PLFLT) 0.0, 0, "abcgnstv", (PLFLT) 0.0, 0); break; case 3: plbox("abcgnsth", (PLFLT) 0.0, 0, "abcgnstvh", (PLFLT) 0.0, 0); break; case 10: plbox("bclnst", (PLFLT) 0.0, 0, "bcnstv", (PLFLT) 0.0, 0); break; case 11: plbox("abclnst", (PLFLT) 0.0, 0, "abcnstv", (PLFLT) 0.0, 0); break; case 12: plbox("abcglnst", (PLFLT) 0.0, 0, "abcgnstv", (PLFLT) 0.0, 0); break; case 13: plbox("abcglnsth", (PLFLT) 0.0, 0, "abcgnstvh", (PLFLT) 0.0, 0); break; case 20: plbox("bcnst", (PLFLT) 0.0, 0, "bclnstv", (PLFLT) 0.0, 0); break; case 21: plbox("abcnst", (PLFLT) 0.0, 0, "abclnstv", (PLFLT) 0.0, 0); break; case 22: plbox("abcgnst", (PLFLT) 0.0, 0, "abcglnstv", (PLFLT) 0.0, 0); break; case 23: plbox("abcgnsth", (PLFLT) 0.0, 0, "abcglnstvh", (PLFLT) 0.0, 0); break; case 30: plbox("bclnst", (PLFLT) 0.0, 0, "bclnstv", (PLFLT) 0.0, 0); break; case 31: plbox("abclnst", (PLFLT) 0.0, 0, "abclnstv", (PLFLT) 0.0, 0); break; case 32: plbox("abcglnst", (PLFLT) 0.0, 0, "abcglnstv", (PLFLT) 0.0, 0); break; case 33: plbox("abcglnsth", (PLFLT) 0.0, 0, "abcglnstvh", (PLFLT) 0.0, 0); break; default: plwarn("plenv: Invalid axis argument"); } }
int plp_draw(double *signal, int *signal_lengths, int ylog_scale) { int count; int i,j; int col; int dowind; for (i=0;i<2*NOF_INPUT_ITF;i++) { if (signal_lengths[i] > INPUT_MAX_SAMPLES) { moderror_msg("plplot buffer configured for %d samples but received %d in signal %d\n", INPUT_MAX_SAMPLES,signal_lengths[i],i); return -1; } } dowind=0; xmax=-1; for(i=0;i<2*NOF_INPUT_ITF;i++) { if (signal_lengths[i]) { dowind=1; xmax = (PLFLT) MAX(xmax,signal_lengths[i]); for (j=0;j<signal_lengths[i];j++) { ymin = (PLFLT) MIN(ymin,signal[i*INPUT_MAX_SAMPLES+j]); ymax = (PLFLT) MAX(ymax,signal[i*INPUT_MAX_SAMPLES+j]); } } } if (!dowind) { xmin=0; xmax=100; ymin=-1; ymax=1; } plclear(); plscolbg(255, 255, 255); plvsta(); plwid(1); plwind(xmin, xmax, ymin*1.1, ymax*1.1); plcol0(1); if (ylog_scale) { plbox(logaxis_x, 0., 0, logaxis_y, 0., 0); } else { plbox(axis_x, 0., 0, axis_y, 0., 0); } plcol0(4); plbox("g", 0, 0, "g", 0, 0); plcol0(1); pllab(xlabel, ylabel, ""); draw_legend(); plwid(4); col=3; for (i=0;i<2*NOF_INPUT_ITF;i++) { if (signal_lengths[i]) { plcol0(line_colors[i]); plline(signal_lengths[i], t, &signal[i*INPUT_MAX_SAMPLES]); col++; if (col==4) col++; } } plflush(); // force an update of the tk driver }