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

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.9 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_log.php');
4require_once ('jpgraph/jpgraph_line.php');
5require_once ('jpgraph/jpgraph_scatter.php');
6
7
8$ab2  = array( 1.5,  2.0,  2.5,  3.0,  4.0,  5.0,  6.0,  8.0, 10.0,
9              12.0, 15.0, 20.0, 25.0, 30.0, 40.0, 50.0, 60.0 ,75.0,
10              100., 125., 150.);
11$mn2  = array( 0.5,  0.5,  0.5,  0.5,  0.8,  0.8,  0.8,  0.8,  1.0,
12               1.0,  1.0,  1.0,  1.0,  2.0,  2.0,  2.0,  2.0,  2.0,
13               5.0,  5.0,  5.0);
14$rhos = array(30.0, 31.0, 32.0, 34.0, 35.5, 37.5, 38.0, 39.5, 41.5,
15              43.0, 41.0, 42.0, 42.5, 45.0, 49.0, 53.5, 58.0, 66.5,
16              75.0, 81.0, 89.0);
17
18// Create the graph.
19$graph = new Graph(500,300);     
20$graph->SetScale("loglog");             
21$graph->SetY2Scale("lin");               
22$graph->y2axis->SetColor("blue","blue"); 
23
24$graph->img->SetMargin(50,70,40,50);     
25$graph->title->Set("Geoelektrik");       
26$graph->xaxis->title->Set("Auslage ab/2 [m]"); 
27$graph->yaxis->title->Set("rho_s [Ohm m]");     
28$graph->y2axis->title->Set("mn/2 [m]");         
29$graph->y2axis->title->SetColor("blue");
30$graph->y2axis->SetTitleMargin(35);
31$graph->title->SetFont(FF_FONT1,FS_BOLD);       
32$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
33$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); 
34$graph->xgrid->Show(true,true);                 
35$graph->ygrid->Show(true,true);                 
36
37// Create the linear plot
38
39$lineplot=new LinePlot($rhos,$ab2);       
40$lineplot->SetWeight(1);
41$lineplot->mark->SetType(MARK_FILLEDCIRCLE);
42$lineplot->mark->SetWidth(2);
43
44// Create scatter plot
45
46$scplot=new ScatterPlot($mn2,$ab2);
47$scplot->mark->SetType(MARK_FILLEDCIRCLE);
48$scplot->mark->SetColor("blue");
49$scplot->mark->SetWidth(2);
50
51// Add plots to the graph
52
53$graph->AddY2($scplot);
54$graph->Add($lineplot);
55
56// Display the graph
57$graph->Stroke();
58
59?>
Note: See TracBrowser for help on using the repository browser.