Histogram

The Histogram is a plot operator that computes a histogram plot either over attributes of a vector dataset or values of a raster source. The output is a plot in Vega-Lite specification.

For instance, you want to plot the data distribution of numeric attributes of a feature collection. Then you can use a histogram with a suitable number of buckets to visualize and assess this.

Parameters

ParameterTypeDescriptionExample Value
columnNamestring, ignored for raster inputThe name of the attribute making up the x-axis of the histogram."temperature"
boundsHistogramBounds (either data or specified values)If data, it computes the bounds of the underlying data. If values, one can specify custom bounds.
{
  "min": 0.0,
  "max": 20.0
}
"data"
bucketsNumber or SquareRootChoiceRuleThe number of buckets. The value can be specified or calculated.
{
  "type": "number",
  "value": 20
}
interactive(Optional) booleanFlag, if the histogram should have user interactions for a range selection. It is false by default.true

Inputs

The operator consumes either one vector or one raster operator.

ParameterType
sourceSingleRasterOrVectorSource

Errors

The operator returns an error if the selected column (columnName) does not exist or is not numeric.

Notes

If bounds or buckets are not defined, the operator will determine these values by itself which requires processing the data twice.

If the buckets parameter is set to squareRootChoiceRule, the operator estimates it using the square root of the number of elements in the data.

Example JSON

{
  "type": "Histogram",
  "params": {
    "columnName": "foobar",
    "bounds": {
      "min": 5.0,
      "max": 10.0
    },
    "buckets": {
      "type": "number",
      "value": 15
    },
    "interactive": false
  },
  "sources": {
    "vector": {
      "type": "OgrSource",
      "params": {
        "data": "ndvi"
      }
    }
  }
}