Class Stats1Plotter

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

public class Stats1Plotter extends Object implements Plotter<Stats1Plotter.StatsStyle>
Plotter to calculate and display univariate statistics of histogram-like data.
Since:
30 Sep 2016
Author:
Mark Taylor
  • Field Details

    • CONST_KEY

      public static final ReportKey<Double> CONST_KEY
      Report key for fitted multiplicative constant.
    • MEAN_KEY

      public static final ReportKey<Double> MEAN_KEY
      Report key for fitted mean.
    • STDEV_KEY

      public static final ReportKey<Double> STDEV_KEY
      Report key for fitted standard deviation.
    • FUNCTION_KEY

      public static final ReportKey<String> FUNCTION_KEY
      Report key for gaussian fit function.
    • BINSIZER_KEY

      public static final ConfigKey<BinSizer> BINSIZER_KEY
      Config key for equivalent histogram bar width.
    • NORMALISE_KEY

      public static final ConfigKey<Normalisation> NORMALISE_KEY
      Config key for normalisation.
    • SHOWMEAN_KEY

      public static final ConfigKey<Boolean> SHOWMEAN_KEY
      Config key to display a line at the mean value.
  • Constructor Details

    • Stats1Plotter

      public Stats1Plotter(FloatingCoord xCoord, boolean hasWeight, ConfigKey<Unit> unitKey)
      Constructor.
      Parameters:
      xCoord - X axis coordinate
      hasWeight - true if weights may be used
      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<Stats1Plotter.StatsStyle>
      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<Stats1Plotter.StatsStyle>
      Returns:
      plotter icon
    • 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<Stats1Plotter.StatsStyle>
      Returns:
      true if the plot report may return interesting information
      See Also:
    • 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<Stats1Plotter.StatsStyle>
      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<Stats1Plotter.StatsStyle>
      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<Stats1Plotter.StatsStyle>
      Returns:
      keys used when creating a style for this plotter.
    • createStyle

      public Stats1Plotter.StatsStyle 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<Stats1Plotter.StatsStyle>
      Parameters:
      config - map of style configuration items
      Returns:
      plotter-specific plot style
    • getRangeStyleKey

      public Object getRangeStyleKey(Stats1Plotter.StatsStyle 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<Stats1Plotter.StatsStyle>
      Parameters:
      style - plot style to assess
      Returns:
      opaque object with equality semantics, or null if axis range is not a function of style
    • createLayer

      public PlotLayer createLayer(DataGeom geom, DataSpec dataSpec, Stats1Plotter.StatsStyle style)
      Description copied from interface: Plotter
      Creates a PlotLayer based on the given geometry, data and style.

      The style parameter is the result of a call to Plotter.createStyle(ConfigMap).

      The dataSpec parameter must contain the coordinates defined by this plotter's CoordGroup.

      The pointDataGeom parameter is only used if the CoordGroup.getBasicPositionCount() or CoordGroup.getExtraPositionCount() method from this plotter's CoordGroup return a non-zero value, otherwise the plot does not have point positions.

      It is legal to supply null for any of the parameters; if insufficient data is supplied to generate a plot, then the method should return null.

      Creating a layer should be cheap; layers may be created and not used.

      Specified by:
      createLayer in interface Plotter<Stats1Plotter.StatsStyle>
      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