SetXTickAnchor — Set an anchor point for X tick marks
$plot->SetXTickAnchor([$xta
])
SetXTickAnchor
sets an anchor point for X tick marks.
This ensures that a tick mark will be placed at that value (if it is within
the plotted data range). The effect of this function is to slide the set
of tick marks along the axis until one of them falls on the anchor. This
also affects the position of the tick labels and X grid lines. It does not
change the plotted data values, nor the range of values along the X axis.
$xta
The desired X anchor point, in world coordinates. If omitted or NULL, the default of not using an anchor is restored.
By default, PHPlot will place the left-most tick mark at the left end of the X axis range. For example, if the X range is -5 to 5, and the tick increment is 2, tick marks will be placed at X=-5, -3, -1, 1, 3, and 5. Note that in this case there would be no tick mark at the Y axis position X=0.
When using the default method of calculating and adjusting the plot range,
PHPlot will select a whole multiple of the tick increment as the left end
of the X plot range. Another way of looking at this is that PHPlot implicitly
anchors the X tick marks at 0, when it calculates the range with the
default adjustment method.
If you set the plot range with SetPlotAreaWorld, or
change the range end adjustment method, the tick marks may not be anchored
at 0 unless you use SetXTickAnchor(0)
.
More on this can be found in Section 4.6, “Plot Range and Tick Increment Calculations”.
If an X tick anchor is set, and its value is within the plotted range, PHPlot will adjust the left-most tick mark so that there is a tick mark at the X tick anchor position. For example, if the X range is -5 to 5, the tick increment is 2, and the X tick anchor is set to 0, ticks marks will be placed at X=-4, -2, 0, 2, and 4.
The X tick anchor need not be within the plotted range. If the tick anchor is outside the plotted range, the tick marks will still be adjusted so that a tick marked would be placed at the anchor if the data range was extended to include it. For example, if the X range is -5 to 5, the tick increment is 2, and the X tick anchor is set to 10, ticks marks will still be placed at X=-4, -2, 0, 2, and 4 as in the previous example.
See Section 5.38, “Example - Hourly Data Using X Tick Anchor” for an example of setting an X tick anchor.
This function did not change at PHPlot-6.0.0, however a new method of
automatically calculating the plot range was introduced which always
anchors the X tick marks at 0, when using the default settings.
Therefore, SetXTickAnchor(0)
is usually no
longer needed to get a tick mark at X=0.
In releases before PHPlot-6.0.0, SetXTickAnchor
was
usually necessary to get reasonable tick marks, unless the left end of the X
plot range happened to be 0, or was set to 0 or a multiple of the tick
increment.
This function was added in PHPlot-5.4.0.
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.