| 408 | //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 409 | |
| 410 | void plot(DataFile& df, string Title, string xTitle, string yTitle, int XID, vector <int> IDs) |
| 411 | { |
| 412 | df.SetStartIdx(0); |
| 413 | df.SetEndIdx(df.GetNumRecords()-1); |
| 414 | |
| 415 | metafl("PNG"); |
| 416 | setpag("da4l"); |
| 417 | |
| 418 | disini(); // Initialization |
| 419 | |
| 420 | pagera(); // Set Plot Parameters |
| 421 | // hwfont(); |
| 422 | helve(); |
| 423 | shdcha(); |
| 424 | chncrv("color"); |
| 425 | |
| 426 | axspos(450,1800); // Set plot axis system |
| 427 | axslen(2200,1200); |
| 428 | |
| 429 | int thisplot; // Set plot titles |
| 430 | int numtraces = IDs.size(); |
| 431 | |
| 432 | name((char*)xTitle.c_str(),"x"); |
| 433 | name((char*)yTitle.c_str(),"y"); |
| 434 | labdig(3,"xy"); |
| 435 | ticks(10,"xy"); |
| 436 | titlin((char*)Title.c_str(),1); |
| 437 | |
| 438 | string subtitle = ""; |
| 439 | for (thisplot=0; thisplot < numtraces; thisplot++) { |
| 440 | if (thisplot == 0) subtitle = df.names[IDs[thisplot]]; |
| 441 | else subtitle = subtitle + ", " + df.names[IDs[thisplot]]; |
| 442 | } |
| 443 | |
| 444 | subtitle = subtitle + string(" vs. ") + xTitle; |
| 445 | titlin((char*)(subtitle.c_str()),3); |
| 446 | |
| 447 | // Plot data |
| 448 | |
| 449 | double *timarray = new double[df.GetEndIdx()-df.GetStartIdx()+1]; |
| 450 | |
| 451 | for (int pt=df.GetStartIdx(), pti=0; pt<=df.GetEndIdx(); pt++, pti++) { |
| 452 | timarray[pti] = df.Data[pt][XID]; |
| 453 | } |
| 454 | |
| 455 | float axismax = df.GetAutoAxisMax(IDs[0]); |
| 456 | float axismin = df.GetAutoAxisMin(IDs[0]); |
| 457 | |
| 458 | for (thisplot=1; thisplot < numtraces; thisplot++) { |
| 459 | axismax = axismax > df.GetAutoAxisMax(IDs[thisplot]) ? axismax : df.GetAutoAxisMax(IDs[thisplot]); |
| 460 | axismin = axismin < df.GetAutoAxisMin(IDs[thisplot]) ? axismin : df.GetAutoAxisMin(IDs[thisplot]); |
| 461 | } |
| 462 | |
| 463 | float spread = axismax - axismin; |
| 464 | |
| 465 | if (spread < 1.0) labdig(3,"y"); |
| 466 | else if (spread < 10.0) labdig(2,"y"); |
| 467 | else if (spread < 100.0) labdig(1,"y"); |
no test coverage detected