Class HistogramPlotter

java.lang.Object
uk.ac.starlink.ttools.plot2.layer.HistogramPlotter
All Implemented Interfaces:
Plotter<HistogramPlotter.HistoStyle>

public class HistogramPlotter extends Object implements Plotter<HistogramPlotter.HistoStyle>
Plotter for 1-dimensional histograms. This only works on plane plots.
Since:
8 Jan 2014
Author:
Mark Taylor
  • Field Details

    • BINS_KEY

      public static final ReportKey<BinBag> BINS_KEY
      ReportKey for histogram bins.
    • BINWIDTH_KEY

      public static final ReportKey<Double> BINWIDTH_KEY
      ReportKey for actual bin width.
    • BINTABLE_KEY

      public static final ReportKey<uk.ac.starlink.table.StarTable> BINTABLE_KEY
      ReportKey for tabular result of plot.
    • BINSIZER_KEY

      public static final ConfigKey<BinSizer> BINSIZER_KEY
      Config key for bin size configuration.
    • THICK_KEY

      public static final ConfigKey<Integer> THICK_KEY
      Config key for bar line thickness.
    • PHASE_KEY

      public static final ConfigKey<Double> PHASE_KEY
      Config key for bar phase.
  • Constructor Details

    • HistogramPlotter

      public HistogramPlotter(FloatingCoord xCoord, boolean hasWeight, PerUnitConfigKey<Unit> unitKey)
      Constructor.
      Parameters:
      xCoord - X axis coordinate
      hasWeight - true to permit histogram weighting
      unitKey - config key to select X axis physical units, or null if no unit selection required
  • Method Details

    • getPlotterName

      public String getPlotterName()
      Description copied from interface: Plotter
      Returns the name of this plotter for use in user interface.
      Specified by:
      getPlotterName in interface Plotter<HistogramPlotter.HistoStyle>
      Returns:
      user-directed plotter name
    • getPlotterIcon

      public Icon getPlotterIcon()
      Description copied from interface: Plotter
      Returns an icon for this plotter for use in user interface.
      Specified by:
      getPlotterIcon in interface Plotter<HistogramPlotter.HistoStyle>
      Returns:
      plotter icon
    • 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.

      Specified by:
      getPlotterDescription in interface Plotter<HistogramPlotter.HistoStyle>
      Returns:
      one or more <p> elements
    • getCoordGroup

      public CoordGroup getCoordGroup()
      Description copied from interface: Plotter
      Returns an object describing which data coordinates are used for this plotter and how they are arranged in supplied DataSpec objects.
      Specified by:
      getCoordGroup in interface Plotter<HistogramPlotter.HistoStyle>
      Returns:
      coordinate group
    • 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.
      Specified by:
      getStyleKeys in interface Plotter<HistogramPlotter.HistoStyle>
      Returns:
      keys used when creating a style for this plotter.
    • createStyle

      public HistogramPlotter.HistoStyle 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).
      Specified by:
      createStyle in interface Plotter<HistogramPlotter.HistoStyle>
      Parameters:
      config - map of style configuration items
      Returns:
      plotter-specific plot style
    • getRangeStyleKey

      public Object getRangeStyleKey(HistogramPlotter.HistoStyle 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.

      Specified by:
      getRangeStyleKey in interface Plotter<HistogramPlotter.HistoStyle>
      Parameters:
      style - plot style to assess
      Returns:
      opaque object with equality semantics, or null if axis range is not a function of style
    • hasReports

      public boolean hasReports()
      Description copied from interface: Plotter
      Indicates whether the drawings produced by this plotter will return general interest report information to upstream plotting code.
      Specified by:
      hasReports in interface Plotter<HistogramPlotter.HistoStyle>
      Returns:
      true if the plot report may return interesting information
      See Also:
    • createLayer

      public PlotLayer createLayer(DataGeom geom, DataSpec dataSpec, HistogramPlotter.HistoStyle style)
      The supplied geom is ignored.
      Specified by:
      createLayer in interface Plotter<HistogramPlotter.HistoStyle>
      Parameters:
      geom - indicates base position coordinates and their mapping to points in the data space
      dataSpec - specifies the data required for the plot
      style - data style as obtained from createStyle
      Returns:
      new plot layer, or null if no drawing will take place
    • getWeightCoordIndex

      public int getWeightCoordIndex()
      Returns the DataSpec coord index used for the weighting data for this plotter. If weighting is not supported, a negative value is returned.
      Returns:
      weight coord index, or -1