SetPlotAreaPixels

SetPlotAreaPixels — Set the limits for the plot area in device coordinates

Synopsis

$plot->SetPlotAreaPixels($x1, $y1, $x2, $y2)
    

Description

SetPlotAreaPixels sets area to be used for the plot within the image, in device coordinates. (Device coordinates are GD coordinates, with the origin at the top left of the image, X values increase to the right, Y values increase down, and the units in pixels.) By default, the plot area is equal to the image area minus the margins (see SetMarginsPixels). Use SetPlotAreaPixels to define a different area. One possible use for this is to place multiple plots on an image. See Example 5.18, “Two Plots on One Image” for an example of multiple plots.

Parameters

$x1, $y1

Device coordinates of the top left corner of the area to use for the plot.

$x2, $y2

Device coordinates of the bottom right corner of the area to use for the plot.

Notes

By default, the plot area is calculated automatically, but SetPlotAreaPixels needs to be used to limit the plot area to only use part of the image if you want to place multiple plots on the image.

With this function, you are specifying the exact dimensions of the plot area, not the plot area with margins. So the supplied coordinates have to account for margins. You cannot use this function along with SetMarginsPixels.

SetPlotAreaPixels and SetPlotAreaWorld can be called in either order. Through PHPlot-5.0.4 this was because SetPlotAreaPixels would reset the scale factors if SetPlotAreaWorld was already called. Starting with PHPlot-5.0.5, both functions just store the information, and no calculations take place until DrawGraph is used.