SetYTickAnchor

SetYTickAnchor — Set an anchor point for Y tick marks

Synopsis

$plot->SetYTickAnchor([$yta])

Description

SetYTickAnchor sets an anchor point for Y 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 Y grid lines. It does not change the plotted data values, nor the range of values along the Y axis.

Parameters

$yta

The desired Y anchor point, in world coordinates. If omitted or NULL, the default of not using an anchor is restored.

Notes

By default, PHPlot will place the bottom-most tick mark at the bottom of the Y axis range. For example, if the Y range is -5 to 5, and the tick increment is 2, tick marks will be placed at Y=-5, -3, -1, 1, 3, and 5. Note that in this case there would be no tick mark at the X axis position Y=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 bottom of the Y plot range. Another way of looking at this is that PHPlot implicitly anchors the Y 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 SetYTickAnchor(0). More on this can be found in Section 4.6, “Plot Range and Tick Increment Calculations”.

If a Y tick anchor is set, and its value is within the plotted range, PHPlot will adjust the bottom-most tick mark so that there is a tick mark at the Y tick anchor position. For example, if the Y range is -5 to 5, the tick increment is 2, and the Y tick anchor is set to 0, ticks marks will be placed at Y=-4, -2, 0, 2, and 4.

The Y 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 Y range is -5 to 5, the tick increment is 2, and the Y tick anchor is set to 10, ticks marks will still be placed at Y=-4, -2, 0, 2, and 4 as in the previous example.

See Section 5.37, “Example - Setting a Y Tick Anchor” for an example of setting a Y tick anchor.

History

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 Y tick marks at 0, when using the default settings. Therefore, SetYTickAnchor(0) is usually no longer needed to get a tick mark at Y=0. In releases before PHPlot-6.0.0, SetYTickAnchor was usually necessary to get reasonable tick marks, unless the bottom of the Y 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.

SourceForge.net 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.