SetLegendUseShapes

SetLegendUseShapes — Use color boxes or point shapes in the legend

Synopsis

$plot->SetLegendUseShapes($use_shapes)

Description

SetLegendUseShapes sets the legend to use either color boxes or point shapes to show which legend line goes with which data set.

Parameters

$use_shapes

A boolean value: true to use point shapes, false to use color boxes.

Notes

By default, the legend is drawn with color boxes.

Use of point shapes in the legend is only available with plot types that use point markers: points and linepoints. SetLegendUseShapes is ignored with other plot types.

When point shape markers are enabled using SetLegendUseShapes(True), PHPlot will first draw a solid box with the same color as the plot area background (if plot area background color is enabled with SetPlotBgColor and SetDrawPlotAreaBackground). Then it will draw the point shape which corresponds to the legend text line, overlaying the background box. The point shape will have the same color and size as the point shape used in the plot for the corresponding data set. Note that PHPlot will not adjust the legend box size or line spacing based on the point shape sizes set with SetPointSizes. If the point shapes are too big, they will overflow their allocated space and overlap. You can control the legend text line height to account for large point shapes by adjusting the line spacing parameter (using SetLineSpacing, SetFont, or related font control functions.

For examples of legends with color boxes and point shapes, see Section 5.35, “Example - Legend with Point Shapes”.

History

This function was added to PHPlot-5.4.0. Before that, only color boxes were available in legends.