1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_line.php'); |
---|
4 | require_once ('jpgraph/jpgraph_log.php'); |
---|
5 | |
---|
6 | // Matrix size rxr |
---|
7 | $r = 10; |
---|
8 | |
---|
9 | // Max Interpolation factor |
---|
10 | $f = 5; |
---|
11 | |
---|
12 | for( $i=1; $i <= $f; ++$i ) { |
---|
13 | $xdata[] = $i; |
---|
14 | $ydata[] = pow( $r*pow(2,($i-1)) - ( pow(2,$i) - 1 ),2); |
---|
15 | } |
---|
16 | |
---|
17 | $graph = new Graph(400,240); |
---|
18 | $graph->SetScale('intlog'); |
---|
19 | $graph->SetMargin(50,50,20,30); |
---|
20 | $graph->SetFrame(false); |
---|
21 | $graph->SetBox(true,'black',2); |
---|
22 | $graph->SetMarginColor('white'); |
---|
23 | $graph->SetColor('lightyellow@0.7'); |
---|
24 | |
---|
25 | $graph->title->Set('Interpolation growth for size 10x10'); |
---|
26 | $graph->title->SetFont(FF_FONT1,FS_BOLD); |
---|
27 | |
---|
28 | $graph->xaxis->SetTitle('Interpolation factor','center'); |
---|
29 | $graph->xaxis->SetTitleMargin(10); |
---|
30 | |
---|
31 | $graph->SetAxisStyle(AXSTYLE_YBOXIN); |
---|
32 | $graph->xgrid->Show(); |
---|
33 | |
---|
34 | $lp1 = new LinePlot($ydata,$xdata); |
---|
35 | $lp1->SetColor('darkred'); |
---|
36 | $lp1->SetWeight(3); |
---|
37 | $graph->Add($lp1); |
---|
38 | |
---|
39 | $graph->Stroke(); |
---|
40 | ?> |
---|
41 | |
---|
42 | |
---|