source: trunk/xgraph/jpgraph/Examples/matrix_ex01.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 943 bytes
Line 
1<?php
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_matrix.php');
4
5$data = array(
6        array(0,1,2,3,4,5,6,7,8,9,10),
7        array(10,9,8,7,6,5,4,3,2,1,0),
8        array(0,1,2,3,4,5,6,7,8,9,10),
9        array(10,9,8,17,6,5,4,3,2,1,0),
10        array(0,1,2,3,4,4,9,7,8,9,10),
11        array(8,1,2,3,4,8,3,7,8,9,10),
12        array(10,3,5,7,6,5,4,3,12,1,0),
13        array(10,9,8,7,6,5,4,3,2,1,0),
14);
15
16// Do the meshinterpolation once for the data
17doMeshInterpolate($data,3);
18
19$graph = new MatrixGraph(550,500);
20$graph->title->Set('Possible legend positions');
21$graph->title->SetFont(FF_ARIAL,FS_BOLD,14);
22
23$mp = array();
24$n = 4;
25$pos = array(0.3,0.33, 0.8,0.68, 
26                         0.3,0.68, 0.8,0.33);
27for($i=0; $i < $n; ++$i){
28    $mp[$i] = new MatrixPlot($data);
29    $mp[$i]->colormap->SetMap($i);
30        $mp[$i]->SetModuleSize(4,5);
31        $mp[$i]->SetLegendLayout($i);
32        $mp[$i]->SetCenterPos($pos[$i*2],$pos[$i*2+1]);
33}
34
35$graph->Add($mp);
36$graph->Stroke();
37
38?>
Note: See TracBrowser for help on using the repository browser.