public abstract class AbstractKernelDensityPlotter extends Pixel1dPlotter<AbstractKernelDensityPlotter.KDenseStyle>
Concrete subclasses have to arrange for the details of exactly how kernels are instantiated from a given kernel shape.
Modifier and Type | Class and Description |
---|---|
static class |
AbstractKernelDensityPlotter.KDenseStyle
Style subclass for kernel density plots.
|
static interface |
AbstractKernelDensityPlotter.KernelFigure
Encapsulates the details of smoothing kernel construction.
|
Pixel1dPlotter.BinArray, Pixel1dPlotter.Pixel1dPlan
Modifier and Type | Field and Description |
---|---|
static ReportKey<double[]> |
BINS_KEY
Report key for plotted bin height in data coordinates.
|
static ConfigKey<Normalisation> |
NORMALISE_KEY
Config key for normalisation.
|
static ConfigKey<Integer> |
THICK_KEY
Config key for line thickness (only effective if fill==false).
|
KERNEL_KEY, SMOOTHSIZER_KEY, SMOOTHWIDTH_KEY
Modifier | Constructor and Description |
---|---|
protected |
AbstractKernelDensityPlotter(FloatingCoord xCoord,
boolean hasWeight,
PerUnitConfigKey<Unit> unitKey,
String name,
Icon icon)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract AbstractKernelDensityPlotter.KernelFigure |
createKernelFigure(ConfigMap config)
Constructs an object for plot-time kernel construction based on
a particular config map.
|
AbstractKernelDensityPlotter.KDenseStyle |
createStyle(ConfigMap config)
Creates a style that can be used when creating a plot layer.
|
protected void |
extendPixel1dCoordinateRanges(Range[] ranges,
boolean[] logFlags,
AbstractKernelDensityPlotter.KDenseStyle style,
DataSpec dataSpec,
DataStore dataStore)
Performs any required range extension.
|
protected Combiner |
getCombiner(AbstractKernelDensityPlotter.KDenseStyle style)
Returns the bin aggregation mode implied by a given style.
|
protected abstract ConfigKey<?>[] |
getKernelConfigKeys()
Returns a list of keys that specify how the smoothing kernel
will be configured.
|
protected LayerOpt |
getLayerOpt(AbstractKernelDensityPlotter.KDenseStyle style)
Returns the LayerOpt suitable for a given style for this plotter.
|
protected ReportMap |
getPixel1dReport(Pixel1dPlotter.Pixel1dPlan plan,
AbstractKernelDensityPlotter.KDenseStyle style,
boolean xLog)
Returns information associated with the plot.
|
protected int |
getPixelPadding(AbstractKernelDensityPlotter.KDenseStyle style,
PlanarSurface surf)
Returns the padding required at both ends of the array of
pixel bins for calculations.
|
Object |
getRangeStyleKey(AbstractKernelDensityPlotter.KDenseStyle style)
Returns an opaque object characterising the region of the plot surface
covered when using a given plotter style.
|
ConfigKey<?>[] |
getStyleKeys()
Returns the configuration keys used to configure style for this plotter.
|
protected void |
paintBins(PlanarSurface surface,
Pixel1dPlotter.BinArray binArray,
AbstractKernelDensityPlotter.KDenseStyle style,
Graphics2D g)
Draws the graphical representation of a given array of counts per
horizontal pixel.
|
createKernel, createLayer, getCombinerKey, getCoordGroup, getDataBins, getEffectiveExtent, getPixelWidth, getPlotterIcon, getPlotterName, getWeightCoordIndex, getWeightingDescription, hasReports, readBins
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPlotterDescription
public static final ReportKey<double[]> BINS_KEY
public static final ConfigKey<Integer> THICK_KEY
public static final ConfigKey<Normalisation> NORMALISE_KEY
protected AbstractKernelDensityPlotter(FloatingCoord xCoord, boolean hasWeight, PerUnitConfigKey<Unit> unitKey, String name, Icon icon)
xCoord
- X axis coordinatehasWeight
- true to permit histogram weightingunitKey
- config key to select X axis physical units,
or null if no unit selection requiredname
- plotter nameicon
- plotter iconprotected abstract ConfigKey<?>[] getKernelConfigKeys()
protected abstract AbstractKernelDensityPlotter.KernelFigure createKernelFigure(ConfigMap config) throws ConfigException
config
- config map with kernel config keys in itConfigException
getKernelConfigKeys()
public ConfigKey<?>[] getStyleKeys()
Plotter
Plotter.createStyle(uk.ac.starlink.ttools.plot2.config.ConfigMap)
method.public AbstractKernelDensityPlotter.KDenseStyle createStyle(ConfigMap config) throws ConfigException
Plotter
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)
.config
- map of style configuration itemsConfigException
protected LayerOpt getLayerOpt(AbstractKernelDensityPlotter.KDenseStyle style)
Pixel1dPlotter
getLayerOpt
in class Pixel1dPlotter<AbstractKernelDensityPlotter.KDenseStyle>
style
- plot styleprotected int getPixelPadding(AbstractKernelDensityPlotter.KDenseStyle style, PlanarSurface surf)
Pixel1dPlotter
getPixelPadding
in class Pixel1dPlotter<AbstractKernelDensityPlotter.KDenseStyle>
style
- plotting stylesurf
- plotting surfaceprotected Combiner getCombiner(AbstractKernelDensityPlotter.KDenseStyle style)
Pixel1dPlotter
getCombiner
in class Pixel1dPlotter<AbstractKernelDensityPlotter.KDenseStyle>
style
- plotting styleprotected void paintBins(PlanarSurface surface, Pixel1dPlotter.BinArray binArray, AbstractKernelDensityPlotter.KDenseStyle style, Graphics2D g)
Pixel1dPlotter
paintBins
in class Pixel1dPlotter<AbstractKernelDensityPlotter.KDenseStyle>
surface
- plotting surfacebinArray
- counts per X axis pixelstyle
- plotting styleg
- graphics contextprotected void extendPixel1dCoordinateRanges(Range[] ranges, boolean[] logFlags, AbstractKernelDensityPlotter.KDenseStyle style, DataSpec dataSpec, DataStore dataStore)
Pixel1dPlotter
extendPixel1dCoordinateRanges
in class Pixel1dPlotter<AbstractKernelDensityPlotter.KDenseStyle>
ranges
- array of data space dimension ranges to updatelogFlags
- array of linear/log flags corresponding to rangesstyle
- plotting styledataSpec
- data specificationdataStore
- data storage objectPlotLayer.extendCoordinateRanges(uk.ac.starlink.ttools.plot.Range[], boolean[], uk.ac.starlink.ttools.plot2.data.DataStore)
public Object getRangeStyleKey(AbstractKernelDensityPlotter.KDenseStyle style)
Plotter
extendCoordinateRanges
).
In many cases, such as scatter-plot-like plotters, the range
is determined only by the coordinate data
(managed by DataSpec
inputs)
so a null value may be returned.
This method is chiefly required by histogram-like plotters for which
the region on the plot surface is not the union of the input positions.
style
- plot style to assessprotected ReportMap getPixel1dReport(Pixel1dPlotter.Pixel1dPlan plan, AbstractKernelDensityPlotter.KDenseStyle style, boolean xLog)
Pixel1dPlotter
getPixel1dReport
in class Pixel1dPlotter<AbstractKernelDensityPlotter.KDenseStyle>
plan
- plotting planstyle
- plot stylexLog
- true iff X axis is logarithmicDrawing.getReport(java.lang.Object)
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.