Skip to content

Commit

Permalink
density: enhance docstring (#4339)
Browse files Browse the repository at this point in the history
Co-authored-by: t-bltg <tf.bltg@gmail.com>
  • Loading branch information
EyaAk and t-bltg authored Sep 9, 2022
1 parent 16a33c3 commit ebd60b6
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/shorthands.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,26 @@ julia> histogram2d(randn(10_000),randn(10_000))
density(x)
density!(x)
Make a line plot of a kernel density estimate of x.
Make a line plot of a kernel density estimate of x. The smoothness of the density plot is defined from `bandwidth` (real positive number).
# Arguments
- `x`: AbstractVector of samples for probability density estimation
# Keyword arguments
- `trim`::Bool: enables cutting off the distribution tails.
- `bandwidth`::Number: a low bandwidth induces under-smoothing, whilst a high bandwidth induces over-smoothing.
# Examples
```julia-repl
julia> density(randn(100), bandwidth = -0.01, trim = false)
output : ERROR: Bandwidth must be positive
julia> density(randn(100), bandwidth = 0.1, trim = false) # a curve with extremity and under-smoothing
julia> density(randn(100), bandwidth = 10, trim = true) # a curve without extremity and over-smoothing
```
# Example
```julia-repl
julia> using StatsPlots
Expand Down

0 comments on commit ebd60b6

Please sign in to comment.