1 //      Histogram demo.
2 //
3 
4 import std.math;
5 import plplot;
6 
7 //--------------------------------------------------------------------------
8 // main
9 //
10 // Draws a histogram from sample data.
11 //--------------------------------------------------------------------------
main(char[][]args)12 int main( char[][] args )
13 {
14     // Parse and process command line arguments
15     plparseopts( args, PL_PARSE_FULL );
16 
17     // Initialize plplot
18     plinit();
19 
20     // Fill up data points
21     const int npts  = 2047;
22     PLFLT     delta = 2.0 * PI / npts;
23     PLFLT[npts] data;
24     for ( size_t i = 0; i < npts; i++ )
25         data[i] = sin( i * delta );
26 
27     plcol0( 1 );
28     plhist( data, -1.1, 1.1, 44, PL_HIST_DEFAULT );
29     plcol0( 2 );
30     pllab( "#frValue", "#frFrequency",
31         "#frPLplot Example 5 - Probability function of Oscillator" );
32 
33     plend();
34 
35     return 0;
36 }
37