[42] | 1 | <?php
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_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 | doMeshInterpolate($data,4);
|
---|
| 17 |
|
---|
| 18 | $graph = new MatrixGraph(850,580);
|
---|
| 19 | $graph->title->Set('Matrix layout example');
|
---|
| 20 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,14);
|
---|
| 21 |
|
---|
| 22 | $mp = array();
|
---|
| 23 | $n = 5;
|
---|
| 24 | for($i=0; $i < $n; ++$i){
|
---|
| 25 | $mp[$i] = new MatrixPlot($data);
|
---|
| 26 | $mp[$i]->colormap->SetMap($i);
|
---|
| 27 | if( $i < 2 )
|
---|
| 28 | $mp[$i]->SetSize(0.35);
|
---|
| 29 | else
|
---|
| 30 | $mp[$i]->SetSize(0.21);
|
---|
| 31 | // We need to make the legend a bit smaller since by
|
---|
| 32 | // defalt has a ~45% height
|
---|
| 33 | $mp[$i]->legend->SetModuleSize(15,2);
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | $hor1 = new LayoutHor(array($mp[0],$mp[1]));
|
---|
| 37 | $hor2 = new LayoutHor(array($mp[2],$mp[3],$mp[4]));
|
---|
| 38 | $vert = new LayoutVert(array($hor1,$hor2));
|
---|
| 39 | $vert->SetCenterPos(0.45,0.5);
|
---|
| 40 |
|
---|
| 41 | $graph->Add($vert);
|
---|
| 42 | $graph->Stroke();
|
---|
| 43 |
|
---|
| 44 | ?>
|
---|