source: trunk/xgraph/jpgraph/Examples/contourex02.php

Last change on this file was 42, checked in by marrucho, 10 years ago
File size: 1.1 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2// Contour plot example 02
3
4require_once ('jpgraph/jpgraph.php');
5require_once ('jpgraph/jpgraph_contour.php');
6
7$data = array(
8    array (12,12,10,10,8,4),
9    array (10,10,8,14,10,3),
10    array (7,7,13,17,12,8),
11    array (4,5,8,12,7,6),
12    array (10,8,7,8,10,4));
13
14// Setup a basic graph context with some generous margins to be able
15// to fit the legend
16$graph = new Graph(500,380);
17$graph->SetMargin(40,140,60,40);
18
19$graph->title->Set("Example of contour plot");
20$graph->title->SetFont(FF_ARIAL,FS_BOLD,14);
21
22// For contour plots it is custom to use a box style ofr the axis
23$graph->legend->SetPos(0.05,0.5,'right','center');
24$graph->SetScale('intint');
25$graph->SetAxisStyle(AXSTYLE_BOXOUT);
26$graph->xgrid->Show();
27$graph->ygrid->Show();
28
29
30// A simple contour plot with 12 isobar lines and flipped Y-coordinates
31$cp = new ContourPlot($data,12,true);
32
33// Display the legend
34$cp->ShowLegend();
35
36// Make the isobar lines slightly thicker
37$graph->Add($cp);
38
39// ... and send the graph back to the browser
40$graph->Stroke();
41
42?>
Note: See TracBrowser for help on using the repository browser.