SetNumXTicks — Set the number of X tick intervals




SetNumXTicks sets the number of tick intervals along the X axis. You can use either this function or SetXTickIncrement (but not both) to control the tick mark spacing.



Integer number of tick intervals. If the value is omitted or an empty string, the default behavior is restored.


SetNumXTicks sets the number of intervals into which PHPlot divides the X data range. If there are N intervals, there might be as many as N+1 tick marks (accounting for one at each end). Or, there might be N or N-1 tick marks, if a tick anchor is set with SetXTickAnchor, or if PHPlot is told to omit tick marks from either end with SetSkipLeftTick or SetSkipRightTick.

If you use SetNumXTicks, you will get exactly that many tick intervals, regardless of whether the resulting tick increment is a whole number. In general, you would only use SetNumXTicks when also using SetPlotAreaWorld to specify both ends of the X plot range. For example:

$plot->SetPlotAreaWorld(0, NULL, 200);

You will have an X range from 0 to 200, with 10 intervals of 20 units.

If neither SetNumXTicks nor SetXTickIncrement is used, the tick interval is automatically calculated by PHPlot. See Section 4.6.7, “Automatic Tick Increment Calculation” for details.


Before PHPlot-6.0.0, if neither the number of ticks nor the tick increment was specified, PHPlot calculated the tick increment as 1/10 of the X data range. Starting with PHPlot-6.0.0, a more complex algorithm is used which tries to produce 'natural' tick increments.

Starting with PHPlot-6.0.0, if you call both SetNumXTicks and SetXTickIncrement, the tick increment has priority and the specified number of ticks is ignored. Before PHPlot-6.0.0, the behavior was order-dependent: whichever function was used last had priority.

Through PHPlot-5.3.0, the argument was required. To restore the default behavior, it was necessary to use SetNumXTicks(''). Starting with PHPlot-5.3.1, the argument may be omitted to restore the default behavior. 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.