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 | // Show axis on all sides
|
---|
23 | $graph->SetAxisStyle(AXSTYLE_BOXOUT);
|
---|
24 |
|
---|
25 | // Adjust the margins to fit the margin
|
---|
26 | $graph->SetMargin(30,100,40,30);
|
---|
27 |
|
---|
28 | // Setup
|
---|
29 | $graph->title->Set('Basic contour plot with multiple axis');
|
---|
30 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,12);
|
---|
31 |
|
---|
32 | // A simple contour plot with default arguments (e.g. 10 isobar lines)
|
---|
33 | $cp = new ContourPlot($data,5);
|
---|
34 |
|
---|
35 | // Display the legend
|
---|
36 | $cp->ShowLegend();
|
---|
37 |
|
---|
38 | $graph->Add($cp);
|
---|
39 |
|
---|
40 | // ... and send the graph back to the browser
|
---|
41 | $graph->Stroke();
|
---|
42 |
|
---|
43 | ?>
|
---|