Package uk.ac.starlink.ttools.plot
Class AxisLabels
java.lang.Object
uk.ac.starlink.ttools.plot.AxisLabels
Contains labels for an axis.
The instance methods of this class don't do anything clever, but
factory methods are provided which can perform sensible axis labelling.
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
getCount()
Returns the number of ticks on the axis.getLabel
(int itick) Returns the label for one of the tick marks.double
getTick
(int itick) Returns the axis position of one of the tick marks.static AxisLabels
labelLinearAxis
(double lo, double hi, int approxTicks) Sets up axis labels for a linearly scaled axis.static AxisLabels
labelLogAxis
(double lo, double hi, int approxTicks) Sets up axis labels for a logarithmically scaled axis.static void
toString()
-
Constructor Details
-
AxisLabels
Sets up a new AxisLabels.- Parameters:
ticks
- numeric values of the tickslabels
- string values for each of the elements ofticks
-
-
Method Details
-
getCount
public int getCount()Returns the number of ticks on the axis.- Returns:
- tick count
-
getTick
public double getTick(int itick) Returns the axis position of one of the tick marks.- Parameters:
itick
- index of the tick- Returns:
- tick value
-
getLabel
Returns the label for one of the tick marks. This is essentially a stringification ofgetTick(itick)
, but some attempt may be made to make the representation compact and tidy.- Parameters:
itick
- index of the tick- Returns:
- tick label
-
toString
-
labelLinearAxis
Sets up axis labels for a linearly scaled axis.- Parameters:
lo
- lower bound of the axishi
- upper bound of the axisapproxTicks
- the approximate number of ticks you'd like to see
-
labelLogAxis
Sets up axis labels for a logarithmically scaled axis.- Parameters:
lo
- lower bound of axishi
- upper bound of axisapproxTicks
- the approximate number of ticks you'd like to see
-
main
-