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

Last change on this file was 42, checked in by marrucho, 10 years ago
File size: 1.1 KB
Line 
1<?php
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_matrix.php');
4
5$data = array(
6array(0,1,2,3,4,5,6,7,8,9,10),
7array(10,9,8,7,6,5,4,3,2,1,0),
8array(0,1,2,3,4,5,6,7,8,9,10),
9array(10,9,8,17,6,5,4,3,2,1,0),
10array(0,1,2,3,4,4,9,7,8,9,10),
11array(8,1,2,3,4,8,3,7,8,9,10),
12array(10,3,5,7,6,5,4,3,12,1,0),
13array(10,9,8,7,6,5,4,3,2,1,0),
14);
15
16doMeshInterpolate($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;
24for($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?>
Note: See TracBrowser for help on using the repository browser.