Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

hist.im

Histogram of Pixel Values in an Image


Description

Computes and displays a histogram of the pixel values in a pixel image. The hist method for class "im".

Usage

## S3 method for class 'im'
hist(x, ..., probability=FALSE, xname)

Arguments

x

A pixel image (object of class "im").

...

Arguments passed to hist.default or barplot.

probability

Logical. If TRUE, the histogram will be normalised to give probabilities or probability densities.

xname

Optional. Character string to be used as the name of the dataset x.

Details

This function computes and (by default) displays a histogram of the pixel values in the image x.

An object of class "im" describes a pixel image. See im.object) for details of this class.

The function hist.im is a method for the generic function hist for the class "im".

Any arguments in ... are passed to hist.default (for numeric valued images) or barplot (for factor or logical images). For example, such arguments control the axes, and may be used to suppress the plotting.

Value

For numeric-valued images, an object of class "histogram" as returned by hist.default. This object can be plotted.

For factor-valued or logical images, an object of class "barplotdata", which can be plotted. This is a list with components called counts (contingency table of counts of the numbers of pixels taking each possible value), probs (corresponding relative frequencies) and mids (graphical x-coordinates of the midpoints of the bars in the barplot).

Author(s)

See Also

spatialcdf for the cumulative distribution function of an image.

For other statistical graphics such as Q-Q plots, use X[] to extract the pixel values of image X, and apply the usual statistical graphics commands.

For information about pixel images see im.object, summary.im.

Examples

X <- as.im(function(x,y) {x^2}, unit.square())
  hist(X)
  hist(cut(X,3))

spatstat.geom

Geometrical Functionality of the 'spatstat' Family

v2.1-0
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Tilman Davies [ctb], Ute Hahn [ctb], Abdollah Jalilian [ctb], Sebastian Meyer [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Waagepetersen [ctb]
Initial release
2021-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.