SetLegendReverse

SetLegendReverse — Control the order of text lines in the legend

Synopsis

$plot->SetLegendReverse($reverse)

Description

SetLegendReverse is used to change the order of entries in the legend. A legend is drawn if SetLegend is used. The legend consists of a series of text strings and color boxes or shape markers. The contents of the legend helps identify the different data sets in the plot (for example, the separate plot lines). The legend line identifying the first data set is normally drawn at the top of the legend, with the rest of the lines in order below it. SetLegendReverse can be used to reverse that order, so the line for the first data set is drawn at the bottom of the legend.

Parameters

$reverse

True to reverse the order of legend entries (bottom up), False to keep the default order (top down).

Notes

The main use of this function is to set the legend line order for stackedarea, stackedbars, and stackedsquaredarea plots. In these plot types, the first data set (bar segment or area section) is plotted along the the bottom of the plot, with subsequent data sets in order above it. By default, a legend for these plot types will correctly identify the data sets by color, but the entries in the legend will be in the opposite order compared to the data sets and colors on the plot. Use $plot->SetLegendReverse(True) with these plot types to keep the legend entries and plotted data sets in the same order.

See Section 5.15, “Example - Stacked Bars, Unshaded” for an example showing the legend ordering reversal, compared to Section 5.14, “Example - Stacked Bars, Shaded”.

History

This function was added to PHPlot-5.5.0.

SourceForge.net Logo

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.