# Class DensogramPlotter

java.lang.Object
uk.ac.starlink.ttools.plot2.layer.Pixel1dPlotter<DensogramPlotter.DensoStyle>
uk.ac.starlink.ttools.plot2.layer.DensogramPlotter

All Implemented Interfaces:
  `Plotter<DensogramPlotter.DensoStyle>`

public class DensogramPlotter extends Pixel1dPlotter<DensogramPlotter.DensoStyle>
Plots a histogram-like density map - a one-dimensional colour bar indicating density on the horizontal axis.

Since:
  20 Feb 2015
Author:
  Mark Taylor

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`DensogramPlotter.DensoStyle`
Plotting style for this class.

### Nested classes/interfaces inherited from class Pixel1dPlotter

`Pixel1dPlotter.BinArray, Pixel1dPlotter.Pixel1dPlan`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final ConfigKey<Integer>`
`EXTENT_KEY`
Config key for the height of the density bar.
`static final ConfigKey<Double>`
`POSITION_KEY`
Config key for the position of the density bar.
`static final RampKeySet`
`RAMP_KEYSET`
Config keyset for the colour ramp.

### Fields inherited from class Pixel1dPlotter

`KERNEL_KEY, SMOOTHSIZER_KEY, SMOOTHWIDTH_KEY`

## Constructor Summary

Constructors
Constructor
Description
`DensogramPlotter(FloatingCoord xCoord, boolean hasWeight)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`DensogramPlotter.DensoStyle`
`createStyle(ConfigMap config)`
Creates a style that can be used when creating a plot layer.
`protected void`
`extendPixel1dCoordinateRanges(Range[] ranges, boolean[] logFlags, DensogramPlotter.DensoStyle style, DataSpec dataSpec, DataStore dataStore)`
Performs any required range extension.
`protected Combiner`
`getCombiner(DensogramPlotter.DensoStyle style)`
Returns the bin aggregation mode implied by a given style.
`protected LayerOpt`
`getLayerOpt(DensogramPlotter.DensoStyle style)`
Returns the LayerOpt suitable for a given style for this plotter.
`protected ReportMap`
`getPixel1dReport(Pixel1dPlotter.Pixel1dPlan plan, DensogramPlotter.DensoStyle style, boolean xLog)`
Returns information associated with the plot.
`protected int`
`getPixelPadding(DensogramPlotter.DensoStyle style, PlanarSurface 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.
`Object`
`getRangeStyleKey(DensogramPlotter.DensoStyle 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 boolean`
`isY(DensogramPlotter.DensoStyle style)`
Returns the sideways flag implied by a given style.
`protected void`
`paintBins(PlanarSurface surface, Pixel1dPlotter.BinArray binArray, DensogramPlotter.DensoStyle style, Graphics2D g)`
Draws the graphical representation of a given array of counts per horizontal pixel.

### Methods inherited from class Pixel1dPlotter

`createKernel, createLayer, getCombinerKey, getCoordGroup, getDataBins, getEffectiveExtent, getPixelWidth, getPlotterIcon, getPlotterName, getWeightCoordIndex, getWeightingDescription, hasReports, readBins`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### RAMP_KEYSET

public static final RampKeySet RAMP_KEYSET
Config keyset for the colour ramp.

### EXTENT_KEY

public static final ConfigKey<Integer> EXTENT_KEY
Config key for the height of the density bar.

### POSITION_KEY

public static final ConfigKey<Double> POSITION_KEY
Config key for the position of the density bar.

## Constructor Details

### DensogramPlotter

public DensogramPlotter(FloatingCoord xCoord, boolean hasWeight)
Constructor.

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

## Method Details

### 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(ConfigMap)` method.

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

### createStyle

public DensogramPlotter.DensoStyle 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(DataGeom, DataSpec, S)`.

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

### getRangeStyleKey

public Object getRangeStyleKey(DensogramPlotter.DensoStyle style)
Description copied from interface: `Plotter`
Returns an opaque object characterising the region of the plot surface covered when using a given plotter style. If this object changes between layers produced by this plotter, it provides a hint that it may be necessary to redetermine the axis ranges (using `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.

Parameters:
  `style` - plot style to assess
Returns:
  opaque object with equality semantics, or null if axis range is not a function of style

### paintBins

protected void paintBins(PlanarSurface surface, Pixel1dPlotter.BinArray binArray, DensogramPlotter.DensoStyle 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<DensogramPlotter.DensoStyle>`
Parameters:
  `surface` - plotting surface
  `binArray` - counts per X axis pixel
  `style` - plotting style
  `g` - graphics context

### isY

protected boolean isY(DensogramPlotter.DensoStyle style)
Description copied from class: `Pixel1dPlotter`
Returns the sideways flag implied by a given style.

Specified by:
  `isY` in class `Pixel1dPlotter<DensogramPlotter.DensoStyle>`
Parameters:
  `style` - plot style
Returns:
  if true, plot is sideways

### getLayerOpt

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

Specified by:
  `getLayerOpt` in class `Pixel1dPlotter<DensogramPlotter.DensoStyle>`
Parameters:
  `style` - plot style
Returns:
  layer option flags

### getPixelPadding

protected int getPixelPadding(DensogramPlotter.DensoStyle style, PlanarSurface 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<DensogramPlotter.DensoStyle>`
Parameters:
  `style` - plotting style
  `surf` - plotting surface
Returns:
  padding in pixels required in bin array

### getCombiner

protected Combiner getCombiner(DensogramPlotter.DensoStyle style)
Description copied from class: `Pixel1dPlotter`
Returns the bin aggregation mode implied by a given style.

Specified by:
  `getCombiner` in class `Pixel1dPlotter<DensogramPlotter.DensoStyle>`
Parameters:
  `style` - plotting style
Returns:
  pixel bin aggregation mode

### extendPixel1dCoordinateRanges

protected void extendPixel1dCoordinateRanges(Range[] ranges, boolean[] logFlags, DensogramPlotter.DensoStyle 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<DensogramPlotter.DensoStyle>`
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(Range[], boolean[], DataStore)`

### getPixel1dReport

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

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