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

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.layer.Pixel1dPlotter<KernelDensityPlotter.KDenseStyle>
      extended by uk.ac.starlink.ttools.plot2.layer.KernelDensityPlotter
All Implemented Interfaces:
Plotter<KernelDensityPlotter.KDenseStyle>

public class KernelDensityPlotter
extends Pixel1dPlotter<KernelDensityPlotter.KDenseStyle>

Plotter that works like a histogram with pixel-sized bins.

Since:
17 Feb 2015
Author:
Mark Taylor

Nested Class Summary
static class KernelDensityPlotter.KDenseStyle
          Style subclass for kernel density plots.
 
Nested classes/interfaces inherited from class uk.ac.starlink.ttools.plot2.layer.Pixel1dPlotter
Pixel1dPlotter.BinArray, Pixel1dPlotter.Pixel1dPlan
 
Field Summary
static ReportKey<double[]> BINS_KEY
          Report key for plotted bin height in data coordinates.
static ConfigKey<Integer> THICK_KEY
          Config key for line thickness (only effective if fill==false).
 
Fields inherited from class uk.ac.starlink.ttools.plot2.layer.Pixel1dPlotter
KERNEL_KEY, SMOOTHSIZER_KEY, SMOOTHWIDTH_KEY
 
Constructor Summary
KernelDensityPlotter(FloatingCoord xCoord, boolean hasWeight)
          Constructor.
 
Method Summary
 KernelDensityPlotter.KDenseStyle createStyle(ConfigMap config)
          Creates a style that can be used when creating a plot layer.
protected  void extendPixel1dCoordinateRanges(Range[] ranges, boolean[] logFlags, KernelDensityPlotter.KDenseStyle style, DataSpec dataSpec, DataStore dataStore)
          Performs any required range extension.
protected  LayerOpt getLayerOpt(KernelDensityPlotter.KDenseStyle style)
          Returns the LayerOpt suitable for a given style for this plotter.
protected  ReportMap getPixel1dReport(Pixel1dPlotter.Pixel1dPlan plan, KernelDensityPlotter.KDenseStyle style, boolean xLog)
          Returns information associated with the plot.
protected  int getPixelPadding(KernelDensityPlotter.KDenseStyle style, PlaneSurface surf)
          Returns the padding required at both ends of the array of pixel bins for calculations.
 String getPlotterDescription()
          Returns an XML description of this plotter.
 ConfigKey[] getStyleKeys()
          Returns the configuration keys used to configure style for this plotter.
protected  void paintBins(PlaneSurface surface, Pixel1dPlotter.BinArray binArray, KernelDensityPlotter.KDenseStyle style, Graphics2D g)
          Draws the graphical representation of a given array of counts per horizontal pixel.
 
Methods inherited from class uk.ac.starlink.ttools.plot2.layer.Pixel1dPlotter
calculatePixelPlan, createKernel, createLayer, getCoordGroup, getDataBins, getEffectiveExtent, getPlotterIcon, getPlotterName, getWeightCoordIndex, hasReports, readBins
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BINS_KEY

public static final ReportKey<double[]> BINS_KEY
Report key for plotted bin height in data coordinates.


THICK_KEY

public static final ConfigKey<Integer> THICK_KEY
Config key for line thickness (only effective if fill==false).

Constructor Detail

KernelDensityPlotter

public KernelDensityPlotter(FloatingCoord xCoord,
                            boolean hasWeight)
Constructor.

Parameters:
xCoord - X axis coordinate
hasWeight - true to permit histogram weighting
Method Detail

getPlotterDescription

public String getPlotterDescription()
Description copied from interface: Plotter
Returns an XML description of this plotter.

Note: really this should appear at the LayerType level.

Returns:
one or more <p> elements

getStyleKeys

public ConfigKey[] getStyleKeys()
Description copied from interface: Plotter
Returns the configuration keys used to configure style for this plotter. The keys in the return value are used in the map supplied to the Plotter.createStyle(uk.ac.starlink.ttools.plot2.config.ConfigMap) method.

Returns:
keys used when creating a style for this plotter.

createStyle

public KernelDensityPlotter.KDenseStyle createStyle(ConfigMap config)
Description copied from interface: Plotter
Creates a style that can be used when creating a plot layer. The keys that are significant in the supplied config map are those returned by Plotter.getStyleKeys(). The return value can be used as input to Plotter.createLayer(uk.ac.starlink.ttools.plot2.DataGeom, uk.ac.starlink.ttools.plot2.data.DataSpec, S).

Parameters:
config - map of style configuration items
Returns:
plotter-specific plot style

getLayerOpt

protected LayerOpt getLayerOpt(KernelDensityPlotter.KDenseStyle style)
Description copied from class: Pixel1dPlotter
Returns the LayerOpt suitable for a given style for this plotter.

Specified by:
getLayerOpt in class Pixel1dPlotter<KernelDensityPlotter.KDenseStyle>
Parameters:
style - plot style
Returns:
layer option flags

getPixelPadding

protected int getPixelPadding(KernelDensityPlotter.KDenseStyle style,
                              PlaneSurface surf)
Description copied from class: Pixel1dPlotter
Returns the padding required at both ends of the array of pixel bins for calculations.

Specified by:
getPixelPadding in class Pixel1dPlotter<KernelDensityPlotter.KDenseStyle>
Parameters:
style - plotting style
surf - plotting surface
Returns:
padding in pixels required in bin array

paintBins

protected void paintBins(PlaneSurface surface,
                         Pixel1dPlotter.BinArray binArray,
                         KernelDensityPlotter.KDenseStyle style,
                         Graphics2D g)
Description copied from class: Pixel1dPlotter
Draws the graphical representation of a given array of counts per horizontal pixel.

Specified by:
paintBins in class Pixel1dPlotter<KernelDensityPlotter.KDenseStyle>
Parameters:
surface - plotting surface
binArray - counts per X axis pixel
style - plotting style
g - graphics context

extendPixel1dCoordinateRanges

protected void extendPixel1dCoordinateRanges(Range[] ranges,
                                             boolean[] logFlags,
                                             KernelDensityPlotter.KDenseStyle style,
                                             DataSpec dataSpec,
                                             DataStore dataStore)
Description copied from class: Pixel1dPlotter
Performs any required range extension. May be a no-op.

Specified by:
extendPixel1dCoordinateRanges in class Pixel1dPlotter<KernelDensityPlotter.KDenseStyle>
Parameters:
ranges - array of data space dimension ranges to update
logFlags - array of linear/log flags corresponding to ranges
style - plotting style
dataSpec - data specification
dataStore - data storage object
See Also:
PlotLayer.extendCoordinateRanges(uk.ac.starlink.ttools.plot.Range[], boolean[], uk.ac.starlink.ttools.plot2.data.DataStore)

getPixel1dReport

protected ReportMap getPixel1dReport(Pixel1dPlotter.Pixel1dPlan plan,
                                     KernelDensityPlotter.KDenseStyle style,
                                     boolean xLog)
Description copied from class: Pixel1dPlotter
Returns information associated with the plot.

Specified by:
getPixel1dReport in class Pixel1dPlotter<KernelDensityPlotter.KDenseStyle>
Parameters:
plan - plotting plan
style - plot style
xLog - true iff X axis is logarithmic
Returns:
report info, may be null
See Also:
Drawing.getReport(java.lang.Object)


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