# 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"
buckets(Optional) numberThe number of buckets. The value is calculated, if not specified.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 unset, 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": 15,
"interactive": false
},
"sources": {
"vector": {
"type": "OgrSource",
"params": {
"data": {
"type": "internal",
"datasetId": "a626c880-1c41-489b-9e19-9596d129859c"
}
}
}
}
}