Line | |
---|
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 ( 12,7,3,15 ), |
---|
9 | array ( 18,5,1, 9 ), |
---|
10 | array ( 13,9,5,12), |
---|
11 | array ( 5,3,8, 9 ), |
---|
12 | array ( 1,8,5, 7 )); |
---|
13 | |
---|
14 | |
---|
15 | // Basic contour graph |
---|
16 | $graph = new Graph(350,250); |
---|
17 | $graph->SetScale('intint'); |
---|
18 | |
---|
19 | // Show axis on all sides |
---|
20 | $graph->SetAxisStyle(AXSTYLE_BOXOUT); |
---|
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 with multiple axis'); |
---|
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,10,1); |
---|
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 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.