
Image taken from Wisconsin DOT live camera.
Data made up.
Note: This example requires PHPLOT version 4.4.1 or later.
<?
//Include the code
include(
"../phplot.php");
//Define the object
$graph = new PHPlot(500,223,
"",
"0cars.jpg");
//$graph = new PHPlot(423,223);
//Set some data
$example_data = array(
array(
"55",5),
array(
"60",10),
array(
"65",20),
array(
"70",30),
array(
"75",25),
array(
"80",10));
$graph->SetDataValues($example_data);
//Set up some nice formatting things
$graph->SetTitle(
"Speed Histogram");
$graph->SetXLabel(
"Miles per Hour");
$graph->SetYLabel(
"Percent of Cars");
$graph->SetVertTickIncrement(5);
$graph->SetPlotAreaWorld(0,0,6,35);
//Make the margins nice for the background image
$graph->SetMarginsPixels(80,35,35,70);
//Set up some color and printing options
$graph->background_done = 1;
//The image background we get from 0cars.jpg
$graph->SetDrawPlotAreaBackground(0);
//Plot Area background we get from the image
$graph->SetDataColors(array(
"white"),array(
"black"));
//Set Output format
$graph->SetFileFormat(
"png");
//Draw it
$graph->DrawGraph();
?>