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>3.7. Other Plot Elements</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="concepts.html" title="Chapter 3. PHPlot Concepts" /><link rel="prev" href="conc-labels.html" title="3.6. Labels" /><link rel="next" href="conc-text.html" title="3.8. Text Fonts" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.7. Other Plot Elements</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="conc-labels.html">Prev</a> </td><th width="60%" align="center">Chapter 3. PHPlot Concepts</th><td width="20%" align="right"> <a accesskey="n" href="conc-text.html">Next</a></td></tr></table><hr /></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="conc-otherelements"></a>3.7. Other Plot Elements</h2></div></div></div><div class="abstract"><p class="title"><strong></strong></p><p>
|
|
|
3 |
This section contains information about other elements which can be part of
|
|
|
4 |
a plot.
|
|
|
5 |
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="conc-titles"></a>3.7.1. Titles</h3></div></div></div><p>
|
|
|
6 |
PHPlot can draw three types of titles:
|
|
|
7 |
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
|
|
|
8 |
The main plot title, which is centered at the top of the image.
|
|
|
9 |
This is typically used to identify the plot as a whole.
|
|
|
10 |
</p></li><li class="listitem"><p>
|
|
|
11 |
The X title, which is drawn horizontally and can appear below the plot,
|
|
|
12 |
above the plot, or in both places.
|
|
|
13 |
This is typically used to identify the values along the X axis.
|
|
|
14 |
</p></li><li class="listitem"><p>
|
|
|
15 |
The Y title, which is drawn vertically and can appear to the left of the plot,
|
|
|
16 |
to the right of the plot, or on both sides.
|
|
|
17 |
This is typically used to identify the values along the Y axis.
|
|
|
18 |
</p></li></ul></div><p>
|
|
|
19 |
For a list of functions used to control titles,
|
|
|
20 |
see <a class="xref" href="ref-titles.html" title="6.7. Titles">Section 6.7, “Titles”</a>.
|
|
|
21 |
</p><p>
|
|
|
22 |
|
|
|
23 |
Here is a sample plot with the titles called out.
|
|
|
24 |
</p><div class="informalfigure"><div class="mediaobject"><img src="images/typical-titles.png" alt="Titles on a plot" /></div></div><p>
|
|
|
25 |
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="conc-legend"></a>3.7.2. Legend</h3></div></div></div><p>
|
|
|
26 |
PHPlot can draw a legend on the plot. This is normally used with multiple
|
|
|
27 |
data sets, to identify the data sets by color.
|
|
|
28 |
A legend can also be used with pie charts to identify the segments.
|
|
|
29 |
For a list of functions used to control the legend,
|
|
|
30 |
see <a class="xref" href="ref-legend.html" title="6.8. Legend">Section 6.8, “Legend”</a>.
|
|
|
31 |
</p><p>
|
|
|
32 |
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
|
|
|
33 |
Use <a class="xref" href="SetLegend.html" title="SetLegend"><span class="refentrytitle">SetLegend</span></a> to enable the legend and define the text lines
|
|
|
34 |
to be displayed.
|
|
|
35 |
</p></li><li class="listitem"><p>
|
|
|
36 |
You can let PHPlot position the legend, or position it yourself with
|
|
|
37 |
<a class="xref" href="SetLegendPixels.html" title="SetLegendPixels"><span class="refentrytitle">SetLegendPixels</span></a>, <a class="xref" href="SetLegendWorld.html" title="SetLegendWorld"><span class="refentrytitle">SetLegendWorld</span></a>,
|
|
|
38 |
or <a class="xref" href="SetLegendPosition.html" title="SetLegendPosition"><span class="refentrytitle">SetLegendPosition</span></a>.
|
|
|
39 |
</p></li><li class="listitem"><p>
|
|
|
40 |
You can change the legend text color with <a class="xref" href="SetTextColor.html" title="SetTextColor"><span class="refentrytitle">SetTextColor</span></a> or
|
|
|
41 |
<a class="xref" href="SetLegendTextColor.html" title="SetLegendTextColor"><span class="refentrytitle">SetLegendTextColor</span></a>, and the
|
|
|
42 |
background color with <a class="xref" href="SetLegendBgColor.html" title="SetLegendBgColor"><span class="refentrytitle">SetLegendBgColor</span></a>.
|
|
|
43 |
You can control the color box border colors with
|
|
|
44 |
<a class="xref" href="SetLegendColorboxBorders.html" title="SetLegendColorboxBorders"><span class="refentrytitle">SetLegendColorboxBorders</span></a>.
|
|
|
45 |
The colors of the color boxes or shape markers automatically match the
|
|
|
46 |
colors of the plotted data sets, and you cannot control those colors
|
|
|
47 |
separately from the data colors.
|
|
|
48 |
See also <a class="xref" href="conc-colors.html#conc-colors-elements" title="3.5.5. Plot Element Colors">Section 3.5.5, “Plot Element Colors”</a>.
|
|
|
49 |
</p></li><li class="listitem"><p>
|
|
|
50 |
Other aspects of the legend appearance can also be changed.
|
|
|
51 |
Use <a class="xref" href="SetLegendStyle.html" title="SetLegendStyle"><span class="refentrytitle">SetLegendStyle</span></a> to control the text and color box
|
|
|
52 |
alignment, <a class="xref" href="SetLegendUseShapes.html" title="SetLegendUseShapes"><span class="refentrytitle">SetLegendUseShapes</span></a> to select color boxes or
|
|
|
53 |
shape markers, and <a class="xref" href="SetLegendReverse.html" title="SetLegendReverse"><span class="refentrytitle">SetLegendReverse</span></a> if you want the
|
|
|
54 |
entries in the legend ordered from bottom to top.
|
|
|
55 |
</p></li></ul></div><p>
|
|
|
56 |
</p><p>
|
|
|
57 |
|
|
|
58 |
Here is a sample plot with the legend called out.
|
|
|
59 |
</p><div class="informalfigure"><div class="mediaobject"><img src="images/typical-legend.png" alt="Legend on a plot" /></div></div><p>
|
|
|
60 |
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="conc-grid"></a>3.7.3. Grid Lines</h3></div></div></div><p>
|
|
|
61 |
PHPlot can draw horizontal (Y) and/or vertical (X) grid lines on a plot.
|
|
|
62 |
You can independently enable the horizontal (Y) and vertical (X)
|
|
|
63 |
lines in the grid, and use dashed or solid lines.
|
|
|
64 |
For a list of functions used to control the grid,
|
|
|
65 |
see <a class="xref" href="ref-grid.html" title="6.10. Grid Controls">Section 6.10, “Grid Controls”</a>.
|
|
|
66 |
</p><p>
|
|
|
67 |
|
|
|
68 |
Here is a sample plot with the X Grid and Y Grid called out.
|
|
|
69 |
</p><div class="informalfigure"><div class="mediaobject"><img src="images/typical-grid.png" alt="X and Y Grid" /></div></div><p>
|
|
|
70 |
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a id="conc-ticks"></a>3.7.4. Tick Marks</h3></div></div></div><p>
|
|
|
71 |
Tick marks are drawn by default along the bottom edge of the plot (X tick
|
|
|
72 |
marks) and the left side of the plot (Y tick marks).
|
|
|
73 |
These usually, but not always, correspond to the X and Y axis lines.
|
|
|
74 |
You can set the tick interval or control the number of ticks, suppress the
|
|
|
75 |
first or last tick on an axis, and control the tick mark size.
|
|
|
76 |
You can also anchor the tick marks at a specific X or Y value.
|
|
|
77 |
For a list of functions used to control tick marks,
|
|
|
78 |
see <a class="xref" href="ref-ticks.html" title="6.12. Ticks">Section 6.12, “Ticks”</a>.
|
|
|
79 |
</p><p>
|
|
|
80 |
Left to its own, PHPlot will determine tick positions for X and Y axes.
|
|
|
81 |
(See <a class="xref" href="adv-autorange.html#adv-autorange-tick" title="4.6.7. Automatic Tick Increment Calculation">Section 4.6.7, “Automatic Tick Increment Calculation”</a> if you want to read all the
|
|
|
82 |
details on how PHPlot does this.)
|
|
|
83 |
Starting with PHPlot-6.0.0, an attempt is made to pick a good tick increment.
|
|
|
84 |
(Older releases are much less likely to come up with a good result.)
|
|
|
85 |
Even so, you might not be happy with the results.
|
|
|
86 |
You can improve the situation with some combination of: setting
|
|
|
87 |
the desired tick interval, setting a tick anchor point, or using
|
|
|
88 |
<a class="xref" href="SetPlotAreaWorld.html" title="SetPlotAreaWorld"><span class="refentrytitle">SetPlotAreaWorld</span></a> to set the X or Y data range limits
|
|
|
89 |
(since the automatic calculation of tick marks is based on the data range).
|
|
|
90 |
</p><p>
|
|
|
91 |
For example:
|
|
|
92 |
</p><pre class="programlisting">$plot->SetPlotAreaWorld(-10, NULL, 10, NULL);
|
|
|
93 |
$plot->SetXTickIncrement(1);
|
|
|
94 |
</pre><p>
|
|
|
95 |
This results in the X tick labels going from -10 to 10, with a tick mark
|
|
|
96 |
every 1 data unit.
|
|
|
97 |
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="conc-labels.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="concepts.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="conc-text.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3.6. Labels </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 3.8. Text Fonts</td></tr></table></div></body></html>
|