Line | |
---|
1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | |
---|
3 | require_once ('jpgraph/jpgraph.php'); |
---|
4 | require_once ('jpgraph/jpgraph_contourf.php'); |
---|
5 | |
---|
6 | // Setup some data to use for the contour |
---|
7 | $data = array( |
---|
8 | array (12,12,10,10), |
---|
9 | array (10,10,8,14), |
---|
10 | array (7,7,13,17), |
---|
11 | array (4,5,8,12), |
---|
12 | array (10,8,7,8)); |
---|
13 | |
---|
14 | // create a basic graph as a container |
---|
15 | $graph = new Graph(300,300); |
---|
16 | $graph->SetMargin(30, 30, 40, 30); |
---|
17 | $graph->SetScale('intint'); |
---|
18 | $graph->SetMarginColor('white'); |
---|
19 | |
---|
20 | // Setup title of graph |
---|
21 | $graph->title->Set('Filled contour plot'); |
---|
22 | $graph->title->SetFont(FF_VERDANA,FS_BOLD,12); |
---|
23 | |
---|
24 | $graph->subtitle->Set('(No lines, no labels)'); |
---|
25 | $graph->subtitle->SetFont(FF_VERDANA,FS_ITALIC,10); |
---|
26 | |
---|
27 | // Create a new contour plot |
---|
28 | $cp = new FilledContourPlot($data); |
---|
29 | |
---|
30 | // Use only blue/red color schema |
---|
31 | $cp->UseHighContrastColor(true); |
---|
32 | |
---|
33 | // Flip visually |
---|
34 | $cp->SetInvert(); |
---|
35 | |
---|
36 | // Fill the contours |
---|
37 | $cp->SetFilled(true); |
---|
38 | |
---|
39 | // No labels |
---|
40 | $cp->ShowLabels(false); |
---|
41 | |
---|
42 | // No lines |
---|
43 | $cp->ShowLines(false); |
---|
44 | |
---|
45 | // And add the plot to the graph |
---|
46 | $graph->Add($cp); |
---|
47 | |
---|
48 | // Send it back to the client |
---|
49 | $graph->stroke(); |
---|
50 | |
---|
51 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.