[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | // Basic contour plot example
|
---|
| 3 |
|
---|
| 4 | require_once ('jpgraph/jpgraph.php');
|
---|
| 5 | require_once ('jpgraph/jpgraph_contour.php');
|
---|
| 6 |
|
---|
| 7 | $data = array(
|
---|
| 8 | array (0.5,1.1,1.5,1,2.0,3,3,2,1,0.1),
|
---|
| 9 | array (1.0,1.5,3.0,5,6.0,2,1,1.2,1,4),
|
---|
| 10 | array (0.9,2.0,2.1,3,6.0,7,3,2,1,1.4),
|
---|
| 11 | array (1.0,1.5,3.0,4,6.0,5,2,1.5,1,2),
|
---|
| 12 | array (0.8,2.0,3.0,3,4.0,4,3,2.4,2,3),
|
---|
| 13 | array (0.6,1.1,1.5,1,4.0,3.5,3,2,3,4),
|
---|
| 14 | array (1.0,1.5,3.0,5,6.0,2,1,1.2,2.7,4),
|
---|
| 15 | array (0.8,2.0,3.0,3,5.5,6,3,2,1,1.4),
|
---|
| 16 | array (1.0,1.5,3.0,4,6.0,5,2,1,0.5,0.2));
|
---|
| 17 |
|
---|
| 18 | // Basic contour graph
|
---|
| 19 | $graph = new Graph(350,250);
|
---|
| 20 | $graph->SetScale('intint');
|
---|
| 21 |
|
---|
| 22 | // Adjust the margins to fit the margin
|
---|
| 23 | $graph->SetMargin(30,100,40,30);
|
---|
| 24 |
|
---|
| 25 | // Setup
|
---|
| 26 | $graph->title->Set('Basic contour plot');
|
---|
| 27 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,12);
|
---|
| 28 |
|
---|
| 29 | // A simple contour plot with default arguments (e.g. 10 isobar lines)
|
---|
| 30 | $cp = new ContourPlot($data);
|
---|
| 31 |
|
---|
| 32 | // Display the legend
|
---|
| 33 | $cp->ShowLegend();
|
---|
| 34 |
|
---|
| 35 | $graph->Add($cp);
|
---|
| 36 |
|
---|
| 37 | // ... and send the graph back to the browser
|
---|
| 38 | $graph->Stroke();
|
---|
| 39 |
|
---|
| 40 | ?>
|
---|