Class Normalisation
java.lang.Object
uk.ac.starlink.ttools.plot2.layer.Normalisation
Defines normalisation modes for histogram-like plots.
- Since:
- 19 Feb 2015
- Author:
- Mark Taylor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Normalisation
The total area of histogram bars is normalised to unity.static final Normalisation
The total height of histogram bars is normalised to unity.static final Normalisation
Height of the tallest histogram bar is normalised to unity.static final Normalisation
No normalisation is performed.static final Normalisation
Bars scaled by inverse bin width. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Normalisation
(String name, String description) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns a short description of this mode.static Normalisation[]
Returns the Normalisation instances defined by this class.abstract double
getScaleFactor
(double sum, double max, double binWidth, Combiner.Type ctype, boolean isCumulative) Returns the value by which all bins should be scaled to achieve normalisation for a given data set.toString()
-
Field Details
-
NONE
No normalisation is performed. -
AREA
The total area of histogram bars is normalised to unity. -
UNIT
Bars scaled by inverse bin width. -
MAXIMUM
Height of the tallest histogram bar is normalised to unity. -
HEIGHT
The total height of histogram bars is normalised to unity.
-
-
Constructor Details
-
Normalisation
Constructor.- Parameters:
name
- mode namedescription
- short description
-
-
Method Details
-
getDescription
Returns a short description of this mode.- Returns:
- description
-
getScaleFactor
public abstract double getScaleFactor(double sum, double max, double binWidth, Combiner.Type ctype, boolean isCumulative) Returns the value by which all bins should be scaled to achieve normalisation for a given data set.The
binWidth
should at least make sense in terms of screen area. For linear X axis, it should be in data units, but for logarithmic X axis it may have to be in log(data units). ThebinWidth
is only used by AREA and UNIT modes.For cumulative plots, all the modes except NONE behave the same, normalising the total value to unity. The Combiner.Type may result in scaling the values by the inverse of the bin width. However, that is sometimes done anyway (UNIT and AREA modes), so for those cases it's ignored, since you don't want to apply that correction twice.
- Parameters:
sum
- total height of all histogram barsmax
- height of tallest histogram barbinWidth
- constant linear width of histogram bars, or NaNctype
- combiner type used to populate binsisCumulative
- true iff the plot is cumulative
-
toString
-
getKnownValues
Returns the Normalisation instances defined by this class.- Returns:
- list of normalisation instances
-