JpGraph PHP Cross Reference Developer Tools

Source: /Examples/contour2_ex3.php - 55 lines - 1234 bytes - Text - Print

   1  <?php // content="text/plain; charset=utf-8"
   2  
   3  require_once ('jpgraph/jpgraph.php');
   4  require_once ('jpgraph/jpgraph_contourf.php');
   5  
   6  // Setup some data to use for the contour
   7  $data = array(
   8      array (12,12,10,10),
   9      array (10,10,8,14),
  10      array (7,7,13,17),
  11      array (4,5,8,12),
  12      array (10,8,7,8));
  13  
  14  // create a basic graph as a container
  15  $graph = new Graph(300,300);
  16  $graph->SetMargin(30, 30, 40, 30);
  17  $graph->SetScale('intint');
  18  $graph->SetMarginColor('white');
  19  
  20  // Setup title of graph
  21  $graph->title->Set('Filled contour plot');
  22  $graph->title->SetFont(FF_VERDANA,FS_BOLD,12);
  23  
  24  $graph->subtitle->Set('(Manual colors)');
  25  $graph->subtitle->SetFont(FF_VERDANA,FS_ITALIC,10);
  26  
  27  // Create a new contour plot with only 3 isobars
  28  $cp = new FilledContourPlot($data,3);
  29  
  30  // Specify the colors manually
  31  $isobar_colors = array('lightgray','teal:1.3','orange','red');
  32  $cp->SetIsobarColors($isobar_colors);
  33  
  34  // Use only blue/red color schema
  35  $cp->UseHighContrastColor(true);
  36  
  37  // Flip visually 
  38  $cp->SetInvert();
  39  
  40  // Fill the contours
  41  $cp->SetFilled(true);
  42  
  43  // Display labels
  44  $cp->ShowLabels(true);
  45  
  46  // No lines
  47  $cp->ShowLines(false);
  48  
  49  // And add the plot to the graph
  50  $graph->Add($cp);
  51  
  52  // Send it back to the client
  53  $graph->stroke();
  54  
  55  ?>

title

Description

title

Description

title

Description

title

title

Body