PHPlot Reference Manual

The PHPlot Documentation Team

L J Bayuk

Primary author and editor of the manual

Miguel de Benito

Developer and maintainer of PHPlot

Afan Ottenheimer

Original developer of PHPlot
Release 2005-02-27 for PHPlot-5.0

Table of Contents
Preface
1. PHPlot Installation
1.1. Prerequisites
1.2. Installing
1.3. Next Step
2. Getting Started with PHPlot
2.1. Introduction
2.2. Creating the Object
2.3. A Simple Graph
2.4. Different Size Images and Titles
2.5. Multiple Lines Per Graph
2.6. Customization
2.7. What's Next?
3. PHPlot Concepts
3.1. Definitions
3.2. Programming Overview
3.2.1. How It Works
3.2.2. Annotated Example
3.3. PHPlot Data Types
3.3.1. Available Data Types
3.3.2. Building Data Arrays
3.3.3. Missing Data in Data Arrays
3.4. PHPlot Plot Types
3.4.1. Plot Type: area (Area Plot)
3.4.2. Plot Type: bars (Bar Graph)
3.4.3. Plot Type: linepoints (Lines and Points)
3.4.4. Plot Type: line (Lines Graph)
3.4.5. Plot Type: pie (Pie Chart)
3.4.6. Plot Type: points (Styled Dot Plot)
3.4.7. Plot Type: squared (Step Plot)
3.4.8. Plot Type: stackedbars
3.4.9. Plot Type: thinbarline
3.5. Colors
3.5.1. Color Parameter Forms
3.5.2. Built-in Color Maps
3.5.3. Plotting Colors
3.5.4. Transparency
3.6. Labels
3.6.1. Tick Labels
3.6.2. Data Labels
3.6.3. Formatting Labels
3.7. Extra Data Processing
3.7.1. DoScaleData()
3.7.2. DoMovingAverage()
4. PHPlot Function Reference
4.1. Alphabetical List of Functions
4.2. Core
PHPlot -- Construct a new PHPlot Class Object
DrawGraph -- Draw the current graph onto the image
PrintImage -- Output the generated graph image and clean up the internal storage space.
SetDataType -- Indicate the format of the data array
SetDataValues -- Set the data array for plotting
SetPlotType -- Select the type of plot - how the data will be graphed
4.3. Input/Output Control
SetBrowserCache -- Control browser-side image caching
SetFileFormat -- Select the graphic image format generated by PHPlot
SetIsInline -- Set the output image to be "inline" - without HTTP headers
SetOutputFile -- Redirect PHPlot output to a file
SetPrintImage -- Determine whether or not to automatically output the image when the plot is drawn
4.4. Colors and Line Styles
SetBackgroundColor -- Sets the overall background color.
SetDataBorderColors -- Set the rectangle border color on bars and stacked bars
SetDataColors -- Set the colors for plotting data sets
SetDefaultDashedStyle -- Sets the on/off pattern for dashed lines.
SetErrorBarColors -- Sets the colors used for data error bars
SetGridColor -- Set the color used for the axes and borders
SetImageBorderColor -- Set image border color, if enabled
SetLabelColor -- Do not use
SetLightGridColor -- Set the color for grid lines
SetLineStyles -- Set the line style (solid or dashed) for each data set
SetLineWidths -- Set line width (thickness) for each data set
SetPlotBgColor -- Set plot area background color
SetRGBArray -- Select a color map
SetTextColor -- Set general text color
SetTickColor -- Set the color of the axis tick marks
SetTitleColor -- Set the color of the plot titles
SetTransparentColor -- Designate one color to be transparent
4.5. Additional Style Controls
SetBgImage -- Set a graphic file to be used in the graph background
SetDrawBrokenLines -- Sets whether lines should be broken at missing data
SetDrawPlotAreaBackground -- Enables drawing of a plot area background color
SetImageBorderType -- Draw a border around the image
SetPointShapes -- Select a point shape for each data set
SetPointSizes -- Sets the point size for each data set
SetPlotBorderType -- Control how much of a border is drawn around the plot
SetPlotAreaBgImage -- Set a graphic file to be used in the plot area background
SetShading -- Set the size of the drop shadow for bar and pie charts.
4.6. Error Bar Controls
SetErrorBarLineWidth -- Set the line width used for error bars
SetErrorBarShape -- Select line or tee-style error bars
SetErrorBarSize -- Set the size of the error bar tee.
4.7. Text Fonts
SetDefaultTTFont -- Set the default TrueType font
SetFont -- Select which font to use for a plot element
SetLineSpacing -- Set spacing between lines of multi-line elements
SetTTFPath -- Set the name of the default TrueType font directory
SetUseTTF -- Enables or disables use of TrueType fonts
4.8. Titles
SetTitle -- Set the main title text for the plot
SetXTitle -- Sets the X axis title, and optionally its position
SetYTitle -- Sets the Y axis title, and optionally its position
4.9. Legend
SetLegend -- Add text to a legend box
SetLegendPixels -- Position the legend on the image (device coordinates)
SetLegendWorld -- Position the legend on the image (world coordinates)
4.10. Axis Controls
SetXAxisPosition -- Move the X axis
SetXScaleType -- Select linear or logarithmic scale
SetYAxisPosition -- Move the Y axis
SetYScaleType -- Select linear or logarithmic scale
4.11. Grid Controls
SetDrawDashedGrid -- Use solid or dashed lines for the grid
SetDrawXGrid -- Whether or not to draw the X grid lines
SetDrawYGrid -- Whether or not to draw the Y grid lines
4.12. Labels
SetDrawXDataLabelLines -- Draw data lines
SetDrawYDataLabelLines -- Not implemented
SetLabelScalePosition -- Position pie-chart percentage labels
SetPrecisionX -- Set precision for numeric formated X labels
SetPrecisionY -- Set precision for numeric formated Y tick labels
SetXDataLabelPos -- Where to draw the X data labels
SetXLabelAngle -- Set the text angle for X tick and data labels
SetXLabelType -- Set formatting type for X tick and data labels
SetXTickLabelPos -- Position the X tick labels
SetXTimeFormat -- Set date/time formatting string for X labels
SetYDataLabelPos -- Not implemented
SetYLabelAngle -- Set the text angle for Y tick labels
SetYLabelType -- Set formatting type for Y tick labels
SetYTickLabelPos -- Position the Y tick labels
SetYTimeFormat -- Set date/time formatting string for Y labels
4.13. Ticks
SetNumXTicks -- Set the number of X tick marks
SetNumYTicks -- Set the number of Y tick marks
SetSkipBottomTick -- Suppress the bottom Y axis tick mark and label
SetSkipLeftTick -- Suppress the first X axis tick mark and label
SetSkipRightTick -- Suppress the last X axis tick mark and label
SetSkipTopTick -- Suppress the top Y axis tick mark and label
SetXTickCrossing -- Set crossing length of X tick marks
SetXTickIncrement -- Set the step between X ticks
SetXTickLength -- Set outer length of X tick marks
SetXTickPos -- Position the X axis tick marks
SetYTickCrossing -- Set crossing length of Y tick marks
SetYTickIncrement -- Set the step between Y ticks
SetYTickLength -- Set outer length of Y tick marks
SetYTickPos -- Position the Y axis tick marks
4.14. Scaling and Translation
SetMarginsPixels -- Set margins around the plot area
SetPlotAreaPixels -- Set the limits for the plot area in device coordinates
SetPlotAreaWorld -- Override automatic data scaling to device coordinates
5. PHPlot Examples
5.1. Example - Line Plot
5.2. Example - Line Plot: Functions
5.3. Example - Area Plot
5.4. Example - Bar Chart
5.5. Example - Unshaded Bar Chart
5.6. Example - Bar Chart, Label Options
5.7. Example - Line/Point Plot, Point Shapes
5.8. Example - Pie Chart, text-data-single
5.9. Example - Pie Chart, text-data
5.10. Example - Pie Chart, flat with options
5.11. Example - Points Plot with Error Bars
5.12. Example - Points Plot / Scatterplot
5.13. Example - Squared Plot
5.14. Example - Stacked Bars, Shaded
5.15. Example - Stacked Bars, Unshaded
5.16. Example - Thin Bar Line Plot
5.17. Example - Thin Bar Line Plot, Wider Lines
5.18. Example - Two Plots on One Image