Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 0aa83447fab636646dae67f67279757f > files > 6

php-pear-Math_Histogram-0.9.0-19.mga7.noarch.rpm

<?php

require 'Math/Histogram3D.php';

// let's generate some values;
for ($i=0; $i < 100; $i++) {
	$a['x'][$i] = rand(-1,6);
	$a['y'][$i] = rand(-1,6);
}

$h = new Math_Histogram3D();
$h->setData($a);
$h->calculate();
// and output a tab delimited data set
echo $h->toSeparated(HISTOGRAM_MID_BINS, "\t");
// finally, let's get all the histogram info
print_r($h->getHistogramInfo());

// now, let's change the options a wee bit
$h->setBinOptions(
	array(
		'low' => array( 'x' => 0, 'y' => 0),
		'high' => array( 'x' => 5, 'y' => 5),
		'nbins' => array( 'x' => 5, 'y' => 5)
		)
	);
$h->setType(HISTOGRAM_CUMMULATIVE);
$h->calculate();
// and print the whole histogram info, not the different
// statistics for the data and the histogram data entries
print_r($h->getHistogramInfo());
?>