This section contains information about other elements which can be part of a plot.
PHPlot can draw three types of titles:
The main plot title, which is centered at the top of the image. This is typically used to identify the plot as a whole.
The X title, which is drawn horizontally and can appear below the plot, above the plot, or in both places. This is typically used to identify the values along the X axis.
The Y title, which is drawn vertically and can appear to the left of the plot, to the right of the plot, or on both sides. This is typically used to identify the values along the Y axis.
For a list of functions used to control titles, see Section 6.7, “Titles”.
Here is a sample plot with the titles called out.
PHPlot can draw a legend on the plot. This is normally used with multiple data sets, to identify the data sets by color. A legend can also be used with pie charts to identify the segments. For a list of functions used to control the legend, see Section 6.8, “Legend”.
Use SetLegend to enable the legend and define the text lines to be displayed.
You can let PHPlot position the legend, or position it yourself with SetLegendPixels, SetLegendWorld, or SetLegendPosition.
You can change the legend text color with SetTextColor or SetLegendTextColor, and the background color with SetLegendBgColor. You can control the color box border colors with SetLegendColorboxBorders. The colors of the color boxes or shape markers automatically match the colors of the plotted data sets, and you cannot control those colors separately from the data colors. See also Section 3.5.5, “Plot Element Colors”.
Other aspects of the legend appearance can also be changed. Use SetLegendStyle to control the text and color box alignment, SetLegendUseShapes to select color boxes or shape markers, and SetLegendReverse if you want the entries in the legend ordered from bottom to top.
Here is a sample plot with the legend called out.
PHPlot can draw horizontal (Y) and/or vertical (X) grid lines on a plot. You can independently enable the horizontal (Y) and vertical (X) lines in the grid, and use dashed or solid lines. For a list of functions used to control the grid, see Section 6.10, “Grid Controls”.
Here is a sample plot with the X Grid and Y Grid called out.
Tick marks are drawn by default along the bottom edge of the plot (X tick marks) and the left side of the plot (Y tick marks). These usually, but not always, correspond to the X and Y axis lines. You can set the tick interval or control the number of ticks, suppress the first or last tick on an axis, and control the tick mark size. You can also anchor the tick marks at a specific X or Y value. For a list of functions used to control tick marks, see Section 6.12, “Ticks”.
Left to its own, PHPlot will determine tick positions for X and Y axes. (See Section 4.6.7, “Automatic Tick Increment Calculation” if you want to read all the details on how PHPlot does this.) Starting with PHPlot-6.0.0, an attempt is made to pick a good tick increment. (Older releases are much less likely to come up with a good result.) Even so, you might not be happy with the results. You can improve the situation with some combination of: setting the desired tick interval, setting a tick anchor point, or using SetPlotAreaWorld to set the X or Y data range limits (since the automatic calculation of tick marks is based on the data range).
For example:
$plot->SetPlotAreaWorld(-10, NULL, 10, NULL); $plot->SetXTickIncrement(1);
This results in the X tick labels going from -10 to 10, with a tick mark every 1 data unit.
This version of the manual was produced for the
PHPlot Sourceforge project web service site, which requires the logo on each
page.
To download a logo-free copy of the manual, see the
PHPlot project downloads
area.