SetLegend

SetLegend — Add text to a legend box

Synopsis

$plot->SetLegend($leg)
    

Description

SetLegend sets the text to be displayed in the legend. A legend is usually needed when a graph contains multiple plots (that is, more than one data set), to identify the purpose of the different data sets plotted. The legend text consists of multiple lines, with each line identifying one plot (one data set) on the graph. PHPlot adds an identifying color box next to each line in the legend.

Parameters

$leg

An array with each element containing the text for one line of the legend. Or, if not an array, the one line to be appended to the legend. See notes.

Notes

The legend text needs to contain one line of text for each data set plotted on the graph, in the same order as the data array. You can supply all the legend lines in a single call to SetLegend as an array, or you can build up the legend one line at a time with multiple calls to SetLegend, supplying one line per call (in the same order as the data sets in the data array).

By default, no legend is displayed.