Class HistogramPlotter

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, PortablePlaceable, TypedActor, Changeable, Configurable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class HistogramPlotter
    extends PlotterBase
    A histogram plotter. This plotter contains an instance of the Histogram class from the Ptolemy plot package as a public member. A histogram of data at the input port, which can consist of any number of channels, is plotted on this instance. The input data type is double.

    The output plot consists of a set of vertical bars, each representing a histogram bin. The height of the bar is the count of the number of inputs that have been observed that fall within that bin. The n-th bin represents values in the range (x - w/2 + o, x + w/2 + o), where w is the value of the binWidth parameter, and o is the value of the binOffset parameter. So for example, if o = w/2, then each bin represents values from nw to (n + 1)w for some integer n. The default offset is 0.5, half the default bin width, which is 1.0.

    This actor has a legend parameter, which gives a comma-separated list of labels to attach to each dataset. Normally, the number of elements in this list should equal the number of input channels, although this is not enforced.

    Since:
    Ptolemy II 1.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    See Also:
    Histogram
    Pt.AcceptedRating:
    Green (cxh)
    Pt.ProposedRating:
    Green (eal)
    • Field Detail

      • binWidth

        public Parameter binWidth
        The width of the bin of the histogram. This parameter has type double, with default value 1.0.
      • binOffset

        public Parameter binOffset
        The offset for bins of the histogram. This parameter has type double, with default value 0.5.
      • input

        public TypedIOPort input
        The input port, which is a multiport.
    • Method Detail

      • configure

        public void configure​(java.net.URL base,
                              java.lang.String source,
                              java.lang.String text)
                       throws java.lang.Exception
        Configure the plot with data from the specified input source (a URL) and/or textual data, assumed to be in PlotML format. If this is called before the histogram has been created (by calling place() or initialize()), then reading of the input stream is deferred until the histogram is created.
        Specified by:
        configure in interface Configurable
        Overrides:
        configure in class PlotterBase
        Parameters:
        base - The base relative to which references within the input stream are found, or null if this is not known.
        source - The input source, which specifies a URL.
        text - Configuration information given as text.
        Throws:
        java.lang.Exception - If the configuration source cannot be read or if the configuration information is incorrect.
      • _implementDeferredConfigurations

        protected void _implementDeferredConfigurations()
        If configurations have been deferred, implement them now. Also, configure the histogram parameters, if appropriate.
        Overrides:
        _implementDeferredConfigurations in class PlotterBase
      • _newPlot

        protected PlotBox _newPlot()
        Create a new Histogram plot.
        Overrides:
        _newPlot in class PlotterBase
        Returns:
        A new plot object.