# Empirical density contours from an MCMC sample

**URL:** https://discourse.julialang.org/t/empirical-density-contours-from-an-mcmc-sample/78629
**Category:** Probabilistic Programming
**Created:** [March 28, 2022, 5:12pm UTC](https://discourse.julialang.org/t/empirical-density-contours-from-an-mcmc-sample/78629 "2022-03-28T17:12:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dmbates](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmbates/32/44_2.png) [@dmbates](https://discourse.julialang.org/u/dmbates)
#### Post date: [March 28, 2022, 5:12pm UTC](https://discourse.julialang.org/t/empirical-density-contours-from-an-mcmc-sample/78629/1 "2022-03-28T17:12:43Z")

</div>

I have a recollection of seeing two-dimensional empirical density contours from an MCMC (Markov-chain Monte Carlo) sample but I didn’t record the information on the package. Was I remembering correctly and, if so, could someone remind me of the package? I am hoping to adapt such code for parametric bootstrap samples of parameter estimates.

---

<div class="post-metadata">

### Author: ![Stephen\_Wild](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stephen_wild/32/19061_2.png) [@Stephen\_Wild](https://discourse.julialang.org/u/Stephen_Wild)
#### Post date: [March 28, 2022, 8:58pm UTC](https://discourse.julialang.org/t/empirical-density-contours-from-an-mcmc-sample/78629/2 "2022-03-28T20:58:44Z")

</div>

Maybe the [KernelDensityEstimate.jl](https://github.com/JuliaRobotics/KernelDensityEstimate.jl) and [KernelDensityEstimatePlotting.jl](https://github.com/JuliaRobotics/KernelDensityEstimatePlotting.jl) packages?

The README of [KernelDensityEstimate.jl](https://github.com/JuliaRobotics/KernelDensityEstimate.jl) shows what the plots look like.

---

<div class="post-metadata">

### Author: ![mcreel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcreel/32/30088_2.png) [@mcreel](https://discourse.julialang.org/u/mcreel)
#### Post date: [March 29, 2022, 11:52am UTC](https://discourse.julialang.org/t/empirical-density-contours-from-an-mcmc-sample/78629/3 "2022-03-29T11:52:42Z")

</div>

From [matplotlib - A plot describing the density of data points in 2D space in Julia - Stack Overflow](https://stackoverflow.com/questions/58087096/a-plot-describing-the-density-of-data-points-in-2d-space-in-julia) there is the suggestion

```julia
using StatsPlots, KernelDensity
a, b = randn(10000), randn(10000)
dens = kde((a,b))
plot(dens)

```

which looks pretty nice.
