SetPlotAreaWorld
Prev | PHPlot Function Reference | Next

## SetPlotAreaWorld

SetPlotAreaWorld — Override automatic data scaling to device coordinates

## Synopsis

    $plot->SetPlotAreaWorld([$xmin], [$ymin], [$xmax], [$ymax])

## Description

`SetPlotAreaWorld` changes the range for World Coordinate space. This is the coordinate space of the data to be plotted, and is translated and scaled to fit into the Device Coordinate space of the image. By default, PHPlot defines the world coordinate space based on the actual limits of the data to be plotted. By using SetPlotAreaWorld, you can override one or more of the calculated limits. Each parameter you specify overrides the corresponding calculated limit. Each defaulted or NULL parameter is ignored and the calculated limit is used.

## Parameters

`$xmin`

  Optional argument specifying the desired X data range minimum value. If omitted or NULL, the value is calculated from the actual plot data.

`$ymin`

  Optional argument specifying the desired Y data range minimum value. If omitted or NULL, the value is calculated from the actual plot data.

`$xmax`

  Optional argument specifying the desired X data range maximum value. If omitted or NULL, the value is calculated from the actual plot data.

`$ymax`

  Optional argument specifying the desired Y data range maximum value. If omitted or NULL, the value is calculated from the actual plot data.

## Notes

Trailing defaulted arguments can be omitted, but non-trailing defaulted arguments must be specified as NULL. For example, to set the minimum X value to 10, the maximum X value to 100, and default the Y scaling, you can use:

    $plot->SetPlotAreaWorld(10, NULL, 100);

This function has no effect with pie charts, because they do not use world coordinates.

See Section 4.6, “Plot Range and Tick Increment Calculations” for more information about how PHPlot calculates the limits of the World Coordinate space in the absence of values set with `SetPlotAreaWorld`.

## History

Starting with PHPlot-6.0.0, `SetPlotAreaWorld` will stop with an error if a fully specified range is invalid. That is, if both $xmin and $xmax are given and not NULL, $xmin must be less than $xmax. If both $ymin and $ymax are given and not NULL, $ymin must be less than $ymax. In older versions, this error was not detected.

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

Through PHPlot-5.0.4, SetPlotAreaWorld needed to access and interpret the data array, so it had to be called after SetDataValues sets the data array, and after SetDataType (if used). Starting with PHPlot-5.0.5, this restriction no longer applies and the functions can be called in any order.

Prev | Up | Next
SetPlotAreaPixels | Home | SetPlotBgColor