uk.ac.starlink.ttools.plot2.layer
Class BinSizer

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.layer.BinSizer

@Equality
public abstract class BinSizer
extends Object

Determines 1-d histogram bin widths from data bounds.

Since:
8 Jan 2014
Author:
Mark Taylor

Nested Class Summary
static class BinSizer.BinSizerSpecifier
          Specifier for BinSizer values.
 
Constructor Summary
BinSizer()
           
 
Method Summary
static BinSizer createCountBinSizer(double nbin, boolean rounding)
          Returns a bin sizer instance which divides the axis range up into a fixed number of equal intervals.
static BinSizer createFixedBinSizer(double binWidth)
          Returns a bin sizer instance which always returns the same fixed value.
static ConfigKey<BinSizer> createSizerConfigKey(ConfigMeta meta, ReportKey<Double> widthReportKey, int dfltNbin, boolean rounding, boolean allowZero)
          Constructs a config key for acquiring BinSizers.
static String getConfigKeyDescription()
          Returns an XML string describing in general terms how to operate the BinSizer config key.
abstract  double getWidth(boolean xlog, double xlo, double xhi)
          Provides a bin width value for a given axis data range.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinSizer

public BinSizer()
Method Detail

getWidth

public abstract double getWidth(boolean xlog,
                                double xlo,
                                double xhi)
Provides a bin width value for a given axis data range.

Parameters:
xlog - false for linear scaling, true for logarithmic
xlo - axis lower bound
xhi - axis upper bound
Returns:
additive/multiplicative bin width appropriate for the given range

createFixedBinSizer

public static BinSizer createFixedBinSizer(double binWidth)
Returns a bin sizer instance which always returns the same fixed value.

Parameters:
binWidth - fixed bin width
Returns:
bin sizer

createCountBinSizer

public static BinSizer createCountBinSizer(double nbin,
                                           boolean rounding)
Returns a bin sizer instance which divides the axis range up into a fixed number of equal intervals. If the rounding flag is true, the number is approximate, and bin widths returned are round numbers.

Parameters:
nbin - number of intervals to divide the axis into
rounding - if true, only round numbers are returned
Returns:
bin sizer instance

createSizerConfigKey

public static ConfigKey<BinSizer> createSizerConfigKey(ConfigMeta meta,
                                                       ReportKey<Double> widthReportKey,
                                                       int dfltNbin,
                                                       boolean rounding,
                                                       boolean allowZero)
Constructs a config key for acquiring BinSizers.

Parameters:
meta - key metadata
widthReportKey - report key giving bin width in data coordinates
dfltNbin - default bin count
rounding - true to prefer round numbers for output bin widths
allowZero - true iff zero is an allowed width
Returns:
new config key

getConfigKeyDescription

public static String getConfigKeyDescription()
Returns an XML string describing in general terms how to operate the BinSizer config key.

Returns:
XML <p> element(s)


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.