示例#1
0
<?php

// content="text/plain; charset=utf-8"
// Basic contour plot example
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
$data = array(array(12, 7, 3, 15), array(18, 5, 1, 9), array(13, 9, 5, 12), array(5, 3, 8, 9), array(1, 8, 5, 7));
// Basic contour graph
$graph = new Graph\Graph(350, 250);
$graph->SetScale('intint');
// Show axis on all sides
$graph->SetAxisStyle(AXSTYLE_BOXOUT);
// Adjust the margins to fit the margin
$graph->SetMargin(30, 100, 40, 30);
// Setup
$graph->title->Set('Basic contour plot with multiple axis');
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
// A simple contour plot with default arguments (e.g. 10 isobar lines)
$cp = new Plot\ContourPlot($data, 10, 2);
// Display the legend
$cp->ShowLegend();
$graph->Add($cp);
// ... and send the graph back to the browser
$graph->Stroke();
示例#2
0
<?php

// content="text/plain; charset=utf-8"
// Contour plot example
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
$data = array(array(0.5, 1.1, 1.5, 1, 2.0, 3, 3, 2, 1, 0.1), array(1.0, 1.5, 3.0, 5, 6.0, 2, 1, 1.2, 1, 4), array(0.9, 2.0, 2.1, 3, 6.0, 7, 3, 2, 1, 1.4), array(1.0, 1.5, 3.0, 4, 6.0, 5, 2, 1.5, 1, 2), array(0.8, 2.0, 3.0, 3, 4.0, 4, 3, 2.4, 2, 3), array(0.6, 1.1, 1.5, 1, 4.0, 3.5, 3, 2, 3, 4), array(1.0, 1.5, 3.0, 5, 6.0, 2, 1, 1.2, 2.7, 4), array(0.8, 2.0, 3.0, 3, 5.5, 6, 3, 2, 1, 1.4), array(1.0, 1.5, 3.0, 4, 6.0, 5, 2, 1, 0.5, 0.2));
// Setup a basic graph context with some generous margins to be able
// to fit the legend
$graph = new Graph\Graph(500, 380);
$graph->SetMargin(40, 140, 60, 40);
$graph->title->Set('Example of contour plot');
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 14);
// For contour plots it is custom to use a box style ofr the axis
$graph->legend->SetPos(0.05, 0.5, 'right', 'center');
$graph->SetScale('intint');
$graph->SetAxisStyle(AXSTYLE_BOXOUT);
$graph->xgrid->Show();
$graph->ygrid->Show();
// A simple contour plot with default arguments (e.g. 10 isobar lines)
$cp = new Plot\ContourPlot($data);
// Display the legend
$cp->ShowLegend();
// Make the isobar lines slightly thicker
$cp->SetLineWeight(2);
$graph->Add($cp);
// ... and send the graph back to the browser
$graph->Stroke();
示例#3
0
<?php

// content="text/plain; charset=utf-8"
// Basic contour plot example
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
$data = array(array(0.5, 1.1, 1.5, 1, 2.0, 3, 3, 2, 1, 0.1), array(1.0, 1.5, 3.0, 5, 6.0, 2, 1, 1.2, 1, 4), array(0.9, 2.0, 2.1, 3, 6.0, 7, 3, 2, 1, 1.4), array(1.0, 1.5, 3.0, 4, 6.0, 5, 2, 1.5, 1, 2), array(0.8, 2.0, 3.0, 3, 4.0, 4, 3, 2.4, 2, 3), array(0.6, 1.1, 1.5, 1, 4.0, 3.5, 3, 2, 3, 4), array(1.0, 1.5, 3.0, 5, 6.0, 2, 1, 1.2, 2.7, 4), array(0.8, 2.0, 3.0, 3, 5.5, 6, 3, 2, 1, 1.4), array(1.0, 1.5, 3.0, 4, 6.0, 5, 2, 1, 0.5, 0.2));
// Basic contour graph
$graph = new Graph\Graph(350, 250);
$graph->SetScale('intint');
// Show axis on all sides
$graph->SetAxisStyle(AXSTYLE_BOXOUT);
// Adjust the margins to fit the margin
$graph->SetMargin(30, 100, 40, 30);
// Setup
$graph->title->Set('Basic contour plot with multiple axis');
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
// A simple contour plot with default arguments (e.g. 10 isobar lines)
$cp = new Plot\ContourPlot($data);
// Flip the data around its center line
$cp->SetInvert();
// Display the legend
$cp->ShowLegend();
$graph->Add($cp);
// ... and send the graph back to the browser
$graph->Stroke();
示例#4
0
// content="text/plain; charset=utf-8"
// Contour example 05
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
$data = array(array(0.0, 0.001, 0.002, 0.005, -0.003, -0.053, -0.156, -0.245, -0.235, -0.143, -0.056, -0.014, -0.002, 0.0, 0.0), array(0.0, 0.002, 0.008999999999999999, 0.015, -0.04, -0.308, -0.826, -1.257, -1.188, -0.719, -0.28, -0.07000000000000001, -0.011, -0.001, 0.0), array(0.001, 0.005, 0.024, 0.047, -0.103, -0.878, -2.432, -3.767, -3.591, -2.166, -0.828, -0.195, -0.026, -0.001, 0.0), array(0.001, 0.007, 0.046, 0.145, 0.096, -0.913, -3.472, -6.042, -6.038, -3.625, -1.283, -0.235, -0.005, 0.007, 0.002), array(-0.003, -0.008999999999999999, 0.008999999999999999, 0.208, 0.734, 0.864, -0.9370000000000001, -3.985, -4.866, -2.781, -0.5600000000000001, 0.194, 0.151, 0.043, 0.007), array(-0.013, -0.07199999999999999, -0.229, -0.259, 0.652, 2.587, 3.058, 0.661, -1.097, 0.014, 1.336, 1.154, 0.474, 0.113, 0.017), array(-0.028, -0.171, -0.653, -1.397, -1.091, 1.421, 3.424, 1.942, 0.403, 1.784, 2.986, 2.12, 0.821, 0.191, 0.028), array(-0.037, -0.231, -0.9340000000000001, -2.255, -2.78, -0.699, 1.692, 0.981, 0.198, 2.199, 3.592, 2.515, 0.968, 0.225, 0.033), array(-0.031, -0.201, -0.829, -2.076, -2.82, -1.399, 0.61, 0.408, 0.122, 1.882, 3.004, 2.085, 0.8, 0.186, 0.027), array(-0.018, -0.115, -0.469, -1.133, -1.343, 0.011, 1.921, 2.256, 1.824, 2.115, 2.141, 1.312, 0.481, 0.11, 0.016), array(-0.007, -0.039, -0.13, -0.152, 0.5600000000000001, 2.77, 5.591, 6.719, 5.583, 3.646, 1.973, 0.832, 0.251, 0.052, 0.007), array(-0.001, -0.003, 0.024, 0.273, 1.297, 3.628, 6.515, 7.832, 6.517, 3.875, 1.69, 0.546, 0.13, 0.022, 0.003), array(0.0, 0.004, 0.036, 0.215, 0.837, 2.171, 3.809, 4.578, 3.81, 2.218, 0.913, 0.268, 0.056, 0.008, 0.001), array(0.0, 0.002, 0.014, 0.076, 0.284, 0.721, 1.257, 1.511, 1.257, 0.728, 0.294, 0.083, 0.017, 0.002, 0.0), array(0.0, 0.0, 0.003, 0.016, 0.057, 0.144, 0.25, 0.3, 0.25, 0.144, 0.058, 0.016, 0.003, 0.0, 0.0));
// Setup a basic graph context with some generous margins to be able
// to fit the legend
$graph = new Graph\Graph(480, 390);
$graph->SetMargin(40, 120, 60, 50);
$graph->title->Set("Contour plot, high contrast color");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
$graph->title->SetMargin(10);
// For contour plots it is custom to use a box style ofr the axis
$graph->SetScale('intint', 0, 56, 0, 56);
// Setup axis and grids
$graph->SetAxisStyle(AXSTYLE_BOXOUT);
$graph->xgrid->Show(true);
$graph->ygrid->Show(true);
// A simple contour plot with 10 isobar lines and flipped Y-coordinates
// Make the data smoother by interpolate the original matrice by a factor of two
// which will make each grid cell half the original size
$cp = new Plot\ContourPlot($data, 10, 3);
$cp->UseHighContrastColor(true);
// Display the legend
$cp->ShowLegend();
// Make the isobar lines slightly thicker
$graph->Add($cp);
// ... and send the graph back to the browser
$graph->Stroke();
示例#5
0
<?php

// content="text/plain; charset=utf-8"
// Contour plot example
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
$data = array(array(0.5, 1.1, 1.5, 1, 2.0, 3, 3, 2, 1, 0.1), array(1.0, 1.5, 3.0, 5, 6.0, 2, 1, 1.2, 1, 4), array(0.9, 2.0, 2.1, 3, 6.0, 7, 3, 2, 1, 1.4), array(1.0, 1.5, 3.0, 4, 6.0, 5, 2, 1.5, 1, 2), array(0.8, 2.0, 3.0, 3, 4.0, 4, 3, 2.4, 2, 3), array(0.6, 1.1, 1.5, 1, 4.0, 3.5, 3, 2, 3, 4), array(1.0, 1.5, 3.0, 5, 6.0, 2, 1, 1.2, 2.7, 4), array(0.8, 2.0, 3.0, 3, 5.5, 6, 3, 2, 1, 1.4), array(1.0, 1.5, 3.0, 4, 6.0, 5, 2, 1, 0.5, 0.2));
// Setup a basic graph context with some generous margins to be able
// to fit the legend
$graph = new Graph\Graph(500, 380);
$graph->SetMargin(40, 140, 60, 40);
// Enable antialias. Note with antiaaliasing only line weight=1 is supported.
$graph->img->SetAntiAliasing();
$graph->title->Set("Example of contour plot");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 14);
// For contour plots it is custom to use a box style ofr the axis
$graph->legend->SetPos(0.05, 0.5, 'right', 'center');
$graph->SetScale('intint');
$graph->SetAxisStyle(AXSTYLE_BOXOUT);
$graph->xgrid->Show();
$graph->ygrid->Show();
// A simple contour plot with 19 isobars and flipped vertical range
$cp = new Plot\ContourPlot($data, 10, true);
// Display the legend
$cp->ShowLegend();
// Invert the legend to th lowest isobar is on top
$cp->Invertlegend();
$graph->Add($cp);
// ... and send the graph back to the browser
$graph->Stroke();