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.48. Example - Horizontal Linepoints Plot with Data Value Labels and Lines</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-pieangle.html" title="5.47. Example - Pie Chart Start Angle and Direction" /><link rel="next" href="ex-horizerror.html" title="5.49. Example - Horizontal Error Plot" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5.48. Example - Horizontal Linepoints Plot with Data Value Labels and Lines</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ex-pieangle.html">Prev</a> </td><th width="60%" align="center">Chapter 5. PHPlot Examples</th><td width="20%" align="right"> <a accesskey="n" href="ex-horizerror.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-horizlinepts"></a>5.48. Example - Horizontal Linepoints Plot with Data Value Labels and Lines</h2></div></div></div><p>
|
|
|
3 |
This is a horizontal 'linepoints' plot.
|
|
|
4 |
In a horizontal plot, the Y (vertical) axis is for the independent values,
|
|
|
5 |
and the X axis (horizontal) is for the dependent values, so PHPlot is
|
|
|
6 |
graphing <span class="mathphrase">X = F(Y)</span>.
|
|
|
7 |
</p><p>
|
|
|
8 |
This plot has:
|
|
|
9 |
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
|
|
|
10 |
Y axis data labels, which show the values from the label positions in the data
|
|
|
11 |
array along the Y axis
|
|
|
12 |
(see <a class="xref" href="SetYDataLabelPos.html" title="SetYDataLabelPos"><span class="refentrytitle">SetYDataLabelPos</span></a>, not used in the example below
|
|
|
13 |
because the default is to plot labels along the Y axis if they are not
|
|
|
14 |
empty)
|
|
|
15 |
</p></li><li class="listitem"><p>
|
|
|
16 |
X data value labels, which show the X value just above each data point
|
|
|
17 |
(see <a class="xref" href="SetXDataLabelPos.html" title="SetXDataLabelPos"><span class="refentrytitle">SetXDataLabelPos</span></a>)
|
|
|
18 |
</p></li><li class="listitem"><p>
|
|
|
19 |
Y data label lines, which connect the data points horizontally to the Y
|
|
|
20 |
axis data labels (see <a class="xref" href="SetDrawYDataLabelLines.html" title="SetDrawYDataLabelLines"><span class="refentrytitle">SetDrawYDataLabelLines</span></a>)
|
|
|
21 |
</p></li></ul></div><p>
|
|
|
22 |
</p><p>
|
|
|
23 |
Note: Horizontal linepoints plots were added in PHPlot-6.0.0.
|
|
|
24 |
</p><div class="example"><a id="example-horizlinepts"></a><p class="title"><strong>Example 5.48. Horizontal Linepoints Plot with Data Value Labels and Lines</strong></p><div class="example-contents"><div class="informalfigure"><div class="mediaobject"><img src="examples/horizlinepts.png" alt="Horizontal Linepoints Plot with Data Value Labels and Lines Example" /></div></div><pre class="programlisting"><?php
|
|
|
25 |
# PHPlot Example - Horizontal linepoints plot with Y Data Label Lines
|
|
|
26 |
require_once 'phplot.php';
|
|
|
27 |
|
|
|
28 |
$data = array(
|
|
|
29 |
array("SEA\nLEVEL", 0, ''),
|
|
|
30 |
array('100m', 1, 10),
|
|
|
31 |
array('200m', 2, 22),
|
|
|
32 |
array('300m', 3, 30),
|
|
|
33 |
array('400m', 4, 46),
|
|
|
34 |
array('500m', 5, 53),
|
|
|
35 |
array('600m', 6, 65),
|
|
|
36 |
array('700m', 7, 70),
|
|
|
37 |
array('800m', 8, 50),
|
|
|
38 |
array('900m', 9, 35),
|
|
|
39 |
);
|
|
|
40 |
|
|
|
41 |
$plot = new PHPlot(800, 600);
|
|
|
42 |
$plot->SetImageBorderType('plain'); // Improves presentation in the manual
|
|
|
43 |
$plot->SetTitle('Wind Speed at Altitude');
|
|
|
44 |
$plot->SetDataType('data-data-yx');
|
|
|
45 |
$plot->SetDataValues($data);
|
|
|
46 |
$plot->SetPlotType('linepoints');
|
|
|
47 |
$plot->SetPlotAreaWorld(0, 0, 100, 10);
|
|
|
48 |
$plot->SetDrawYDataLabelLines(True);
|
|
|
49 |
$plot->SetXTitle('Wind Speed');
|
|
|
50 |
$plot->SetYTitle('Altitude');
|
|
|
51 |
$plot->SetYTickLabelPos('none');
|
|
|
52 |
$plot->SetYTickPos('none');
|
|
|
53 |
$plot->SetXDataLabelPos('plotin');
|
|
|
54 |
$plot->SetDrawXGrid(False);
|
|
|
55 |
$plot->SetDrawYGrid(False);
|
|
|
56 |
$plot->DrawGraph();
|
|
|
57 |
</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-pieangle.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-horizerror.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">5.47. Example - Pie Chart Start Angle and Direction </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 5.49. Example - Horizontal Error Plot</td></tr></table></div></body></html>
|