Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
98 - 1
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>5.11. Example - Points Plot with Error Bars</title><link rel="stylesheet" type="text/css" href="phplotdoc.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="PHPlot Reference Manual" /><link rel="up" href="examples.html" title="Chapter 5. PHPlot Examples" /><link rel="prev" href="ex-pie3.html" title="5.10. Example - Pie Chart, flat with options" /><link rel="next" href="ex-points2.html" title="5.12. Example - Points Plot / Scatterplot" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5.11. Example - Points Plot with Error Bars</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ex-pie3.html">Prev</a> </td><th width="60%" align="center">Chapter 5. PHPlot Examples</th><td width="20%" align="right"> <a accesskey="n" href="ex-points2.html">Next</a></td></tr></table><hr /></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="ex-points1"></a>5.11. Example - Points Plot with Error Bars</h2></div></div></div><p>
3
This is a point plot with error bars (as indicated by data type
4
'data-data-error'). Each point is specified as X value, Y value, Y error
5
in the positive direction, and Y error in the negative direction.
6
</p><div class="example"><a id="example-points1"></a><p class="title"><strong>Example 5.11. Points Plot with Error Bars</strong></p><div class="example-contents"><div class="informalfigure"><div class="mediaobject"><img src="examples/points1.png" alt="Points Plot with Error Bars Example" /></div></div><pre class="programlisting">&lt;?php
7
# PHPlot Example: Point chart with error bars
8
require_once 'phplot.php';
9
 
10
$data = array(
11
  array('', 1,  23.5, 5, 5), array('', 2,  20.1, 3, 3),
12
  array('', 3,  19.1, 2, 2), array('', 4,  16.8, 3, 3),
13
  array('', 5,  18.4, 4, 6), array('', 6,  20.5, 3, 2),
14
  array('', 7,  23.2, 4, 4), array('', 8,  23.1, 5, 2),
15
  array('', 9,  24.5, 2, 2), array('', 10, 28.1, 2, 2),
16
);
17
 
18
$plot = new PHPlot(800, 600);
19
$plot-&gt;SetImageBorderType('plain');
20
 
21
$plot-&gt;SetPlotType('points');
22
$plot-&gt;SetDataType('data-data-error');
23
$plot-&gt;SetDataValues($data);
24
 
25
# Main plot title:
26
$plot-&gt;SetTitle('Points Plot With Error Bars');
27
 
28
# Set data range and tick increments to get nice even numbers:
29
$plot-&gt;SetPlotAreaWorld(0, 0, 11, 40);
30
$plot-&gt;SetXTickIncrement(1);
31
$plot-&gt;SetYTickIncrement(5);
32
 
33
# Draw both grids:
34
$plot-&gt;SetDrawXGrid(True);
35
$plot-&gt;SetDrawYGrid(True);  # Is default
36
 
37
# Set some options for error bars:
38
$plot-&gt;SetErrorBarShape('tee');  # Is default
39
$plot-&gt;SetErrorBarSize(10);
40
$plot-&gt;SetErrorBarLineWidth(2);
41
 
42
# Use a darker color for the plot:
43
$plot-&gt;SetDataColors('brown');
44
$plot-&gt;SetErrorBarColors('brown');
45
 
46
# Make the points bigger so we can see them:
47
$plot-&gt;SetPointSizes(10);
48
 
49
$plot-&gt;DrawGraph();
50
</pre></div></div><br class="example-break" /></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ex-pie3.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="examples.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ex-points2.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">5.10. Example - Pie Chart, flat with options </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 5.12. Example - Points Plot / Scatterplot</td></tr></table></div></body></html>