density.normal Function (GPL)

Syntax

density.normal(<algebra>, mean(<numeric>), standardDeviation(<numeric>), <function>)

or

density.normal(<binning function>, mean(<numeric>), standardDeviation(<numeric>), <function>)

<algebra>. Graph algebra, such as x*y. Refer to Brief Overview of GPL Algebra for an introduction to graph algebra.

<binning function>. A binning function.

<numeric>. mean and standardDeviation define the parameters for the distribution. These take numeric values. You can use both of them or neither. If no parameters are specified, they are calculated from the underlying data.

<function>. A valid function. Use scaledToData("false") when comparing densities with very different same sizes.

Description

Calculates the probability density of the normal distribution. This is often used to add a distribution curve.

Examples

Figure 1. Example: Adding a normal curve to a histogram
ELEMENT: interval(position(summary.count(bin.rect(x))))
ELEMENT: line(position(density.normal(x)))
Figure 2. Example: Creating a normal curve with specific parameters
ELEMENT: line(position(density.normal(x, mean(50000), standardDeviation(15000))))