Class Stats1Plotter
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.Stats1Plotter
-
- All Implemented Interfaces:
Plotter<Stats1Plotter.StatsStyle>
public class Stats1Plotter extends java.lang.Object implements Plotter<Stats1Plotter.StatsStyle>
Plotter to calculate and display univariate statistics of histogram-like data.- Since:
- 30 Sep 2016
- Author:
- Mark Taylor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStats1Plotter.StatsStyleStyle class associated with this plotter.
-
Field Summary
Fields Modifier and Type Field Description static ConfigKey<BinSizer>BINSIZER_KEYConfig key for equivalent histogram bar width.static ReportKey<java.lang.Double>CONST_KEYReport key for fitted multiplicative constant.static ReportKey<java.lang.String>FUNCTION_KEYReport key for gaussian fit function.static ReportKey<java.lang.Double>MEAN_KEYReport key for fitted mean.static ConfigKey<Normalisation>NORMALISE_KEYConfig key for normalisation.static ConfigKey<java.lang.Boolean>SHOWMEAN_KEYConfig key to display a line at the mean value.static ReportKey<java.lang.Double>STDEV_KEYReport key for fitted standard deviation.
-
Constructor Summary
Constructors Constructor Description Stats1Plotter(FloatingCoord xCoord, boolean hasWeight, ConfigKey<Unit> unitKey)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PlotLayercreateLayer(DataGeom geom, DataSpec dataSpec, Stats1Plotter.StatsStyle style)Creates a PlotLayer based on the given geometry, data and style.Stats1Plotter.StatsStylecreateStyle(ConfigMap config)Creates a style that can be used when creating a plot layer.CoordGroupgetCoordGroup()Returns an object describing which data coordinates are used for this plotter and how they are arranged in supplied DataSpec objects.java.lang.StringgetPlotterDescription()Returns an XML description of this plotter.javax.swing.IcongetPlotterIcon()Returns an icon for this plotter for use in user interface.java.lang.StringgetPlotterName()Returns the name of this plotter for use in user interface.ConfigKey<?>[]getStyleKeys()Returns the configuration keys used to configure style for this plotter.booleanhasReports()Indicates whether the drawings produced by this plotter will return general interest report information to upstream plotting code.
-
-
-
Field Detail
-
CONST_KEY
public static final ReportKey<java.lang.Double> CONST_KEY
Report key for fitted multiplicative constant.
-
MEAN_KEY
public static final ReportKey<java.lang.Double> MEAN_KEY
Report key for fitted mean.
-
STDEV_KEY
public static final ReportKey<java.lang.Double> STDEV_KEY
Report key for fitted standard deviation.
-
FUNCTION_KEY
public static final ReportKey<java.lang.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<java.lang.Boolean> SHOWMEAN_KEY
Config key to display a line at the mean value.
-
-
Constructor Detail
-
Stats1Plotter
public Stats1Plotter(FloatingCoord xCoord, boolean hasWeight, ConfigKey<Unit> unitKey)
Constructor.- Parameters:
xCoord- X axis coordinatehasWeight- true if weights may be usedunitKey- config key to select X axis physical units, or null if no unit selection required
-
-
Method Detail
-
getPlotterName
public java.lang.String getPlotterName()
Description copied from interface:PlotterReturns the name of this plotter for use in user interface.- Specified by:
getPlotterNamein interfacePlotter<Stats1Plotter.StatsStyle>- Returns:
- user-directed plotter name
-
getPlotterIcon
public javax.swing.Icon getPlotterIcon()
Description copied from interface:PlotterReturns an icon for this plotter for use in user interface.- Specified by:
getPlotterIconin interfacePlotter<Stats1Plotter.StatsStyle>- Returns:
- plotter icon
-
hasReports
public boolean hasReports()
Description copied from interface:PlotterIndicates whether the drawings produced by this plotter will return general interest report information to upstream plotting code.- Specified by:
hasReportsin interfacePlotter<Stats1Plotter.StatsStyle>- Returns:
- true if the plot report may return interesting information
- See Also:
Drawing.getReport(java.lang.Object)
-
getPlotterDescription
public java.lang.String getPlotterDescription()
Description copied from interface:PlotterReturns an XML description of this plotter.Note: really this should appear at the LayerType level.
- Specified by:
getPlotterDescriptionin interfacePlotter<Stats1Plotter.StatsStyle>- Returns:
- one or more <p> elements
-
getCoordGroup
public CoordGroup getCoordGroup()
Description copied from interface:PlotterReturns an object describing which data coordinates are used for this plotter and how they are arranged in supplied DataSpec objects.- Specified by:
getCoordGroupin interfacePlotter<Stats1Plotter.StatsStyle>- Returns:
- coordinate group
-
getStyleKeys
public ConfigKey<?>[] getStyleKeys()
Description copied from interface:PlotterReturns the configuration keys used to configure style for this plotter. The keys in the return value are used in the map supplied to thePlotter.createStyle(uk.ac.starlink.ttools.plot2.config.ConfigMap)method.- Specified by:
getStyleKeysin interfacePlotter<Stats1Plotter.StatsStyle>- Returns:
- keys used when creating a style for this plotter.
-
createStyle
public Stats1Plotter.StatsStyle createStyle(ConfigMap config)
Description copied from interface:PlotterCreates a style that can be used when creating a plot layer. The keys that are significant in the supplied config map are those returned byPlotter.getStyleKeys(). The return value can be used as input toPlotter.createLayer(uk.ac.starlink.ttools.plot2.DataGeom, uk.ac.starlink.ttools.plot2.data.DataSpec, S).- Specified by:
createStylein interfacePlotter<Stats1Plotter.StatsStyle>- Parameters:
config- map of style configuration items- Returns:
- plotter-specific plot style
-
createLayer
public PlotLayer createLayer(DataGeom geom, DataSpec dataSpec, Stats1Plotter.StatsStyle style)
Description copied from interface:PlotterCreates a PlotLayer based on the given geometry, data and style.The
styleparameter is the result of a call toPlotter.createStyle(uk.ac.starlink.ttools.plot2.config.ConfigMap).The
dataSpecparameter must contain the coordinates defined by this plotter's CoordGroup.The
pointDataGeomparameter is only used ifgetCoordGroup().getPositionCountreturns 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:
createLayerin interfacePlotter<Stats1Plotter.StatsStyle>- Parameters:
geom- indicates base position coordinates and their mapping to points in the data space; if non-null, the data geom'sDataGeom.hasPosition()method will return truedataSpec- specifies the data required for the plotstyle- data style as obtained fromcreateStyle- Returns:
- new plot layer, or null if no drawing will take place
-
-