Frame Axis Attributes

Frames have a number of attributes which can take multiple values, one for each axis. These separate values are identified by appending the axis number in parentheses to the attribute name. For example, the Label(1) attribute is a character string containing the label which appears on the first axis.

AxisAxis attributes are accessed in the same way as all other attributes (§4.5, §4.6 and §4.7). For example, the Label on the second axis might be obtained as follows:


\begin{terminalv}
const char *label;
\par
...
\par
label = astGetC( frame, ''Label(2)'' );
\end{terminalv}

Other attribute access functions (astSetX, astTestastTest and astClearastClear) may also be applied to axis attributes in the same way.

If the axis number is stored in a program variable, then its value must be formatted to generate a suitable attribute name before using this to access the attribute itself. For example, the following will print out the Label value for each axis of a FrameFrame:


\begin{terminalv}
...

Note the use of the NaxesNaxes attribute to determine the number of Frame axes.

The output from this might look like the following:


\begin{terminalv}
Label 1: Axis 1
Label 2: Axis 2
\end{terminalv}

In this case, the Frame's default axis Labels have been revealed as rather un-exciting. Normally, you would set much more useful values, typically when you create the Frame—perhaps something like:


\begin{terminalv}
frame = astFrame( 2, ''Label(1)=Offset from centre of field,''...
...mm,''
''Label(2)=Transmission coefficient,''
''Unit(2) =%'' );
\end{terminalv}

Here, we have also set the (character string) Unit attribute for each axis to describe the physical units represented on that axis. All the attribute assignments have been combined into a single string, separated by commas.