SetNumYTicks — Set the number of Y tick intervals
$plot->SetNumYTicks([$nt
])
SetNumYTicks
sets the number of tick intervals along
the Y axis.
You can use either this function or SetYTickIncrement
(but not both) to control the tick mark spacing.
$nt
Integer number of tick intervals. If the value is omitted or an empty string, the default behavior is restored.
SetNumYTicks
sets the number of intervals into
which PHPlot divides the Y 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
SetYTickAnchor, or if PHPlot is told to omit tick marks from
either end with SetSkipBottomTick
or SetSkipTopTick.
If you use SetNumYTicks
, 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 SetNumYTicks
when also using SetPlotAreaWorld to specify both ends
of the Y plot range. For example:
$plot->SetPlotAreaWorld(NULL, -10, NULL, 10); $plot->SetNumXTicks(20);
You will have a Y range from -10 to 10, with 20 intervals of 1 unit each.
If neither SetNumYTicks
nor
SetYTickIncrement 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 Y 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 SetNumYTicks
and SetYTickIncrement
, 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
SetNumYTicks('')
.
Starting with PHPlot-5.3.1, the argument may be omitted to restore the
default behavior.