Skip to content

BoxPlot

The BoxPlot is a plot operator that computes a box plot over

  • a selection of numerical columns of a single vector dataset, or
  • a selection of bands of a single raster dataset.

Thereby, the operator considers all data in the given query rectangle. For raster data, these are the pixels that intersect the query rectangle.

The boxes of the plot span the 1st and 3rd quartile and highlight the median. The whiskers indicate the minimum and maximum values of the corresponding attribute or band.

The operator returns an error in the following cases.

  • Vector data: attributes is all.
  • Vector data: One of the selected attributes is not numeric.
  • Vector data: One of the selected attributes does not exist.
  • Raster data: One of the selected attributes (bands) does not exist.
  • Raster data: More than 8 bands are selected.

If your dataset contains infinite or NAN values, they are ignored for the computation. Moreover, if your dataset contains more than 10.000values (which is likely for rasters), the median and quartiles are estimated using the P^2 algorithm described in:

R. Jain and I. Chlamtac, The P^2 algorithm for dynamic calculation of quantiles and histograms without storing observations, Communications of the ACM, Volume 28 (October), Number 10, 1985, p. 1076-1085. https://www.cse.wustl.edu/~jain/papers/ftp/psqr.pdf

Name Type Description Examples
attributes AttributeSelection The attributes to generate boxes for.
For vector data, these are numeric columns and must be given by name.
For raster data, these are bands and default to all.
{"type":"names","values":["ndvi"]}
{"type":"names","values":["red","green"]}
Name Type Description
source SingleRasterOrVectorOperator It is either a single RasterOperator or a single VectorOperator
{
"type": "BoxPlot",
"params": {
"attributes": {
"type": "names",
"values": ["x", "y"]
}
},
"sources": {
"source": {
"type": "OgrSource",
"params": {
"data": "ndvi"
}
}
}
}
{
"type": "BoxPlot",
"params": {
"attributes": {
"type": "names",
"values": ["red", "green"]
}
},
"sources": {
"source": {
"type": "GdalSource",
"params": {
"data": "sentinel2"
}
}
}
}