SetLegendWorld — Position the legend on the image (world coordinates)


$plot->SetLegendWorld($x, $y)


SetLegendWorld lets you position the legend on the image, using world coordinates, rather than letting PHPlot position it for you. (World coordinates are the coordinate space of your data points.)


$x, $y

World coordinates of the upper left corner of the legend box. The units and origin are the same as the data you are plotting.


The default behavior is for PHPlot to position the legend in the upper right corner of the plot area.

See SetLegendPosition for more flexible legend positioning options. SetLegendWorld($x, $y) is equivalent to SetLegendPosition(0, 0, 'world', $x, $y). This places the top left corner of the legend at world coordinates $x, $y with no pixel offset.

See also SetLegendPixels.

This function will not work with pie charts, because they have no valid world coordinates.


This function did actually work with pie charts through PHPlot-5.5.0, although we are not sure what it did, since pie charts do not have valid world coordinates.

Through PHPlot-5.0rc3, it was required that the data array, axis types, and any other setting which affects the scale of the data be set up before this function is used. Starting at PHPlot-5.0.4 this is no longer required, as the coordinates you supply are not scaled until the plot is drawn. 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.