Image obtained by using pbm driver and then converted to png.
1 #pragma _ipath "./" 2 #include "plcdemos.h" 3 4 #define NPTS 2047 5 6 7 int 8 main(int argc, char *argv[]) 9 { 10 int i; 11 PLFLT data[NPTS], delta; 12 13 14 (void) plParseOpts(&argc, argv, PL_PARSE_FULL); 15 16 17 plinit(); 18 19 20 delta = 2.0 * PI / (double) NPTS; 21 for (i = 0; i < NPTS; i++) 22 data[i] = sin(i * delta); 23 24 plcol0(1); 25 plhist(NPTS, data, -1.1, 1.1, 44, 0); 26 plcol0(2); 27 pllab("#frValue", "#frFrequency", 28 "#frPLplot Example 5 - Probability function of Oscillator"); 29 30 plend(); 31 exit(0); 32 }
Code description
- 1
- $Id: x05c.c,v 1.15 2002/12/03 08:39:24 airwin Exp $ Histogram demo.
- 6
- --------------------------------------------------------------------------*\ * main * * Draws a histogram from sample data. \*--------------------------------------------------------------------------
- 13
- Parse and process command line arguments
- 16
- Initialize plplot
- 19
- Fill up data points