Plotting overview
FlexiChains contains a number of functions for visualising chains with Makie.jl and Plots.jl.
The Makie backend is more developed, and we recommend using that in the first instance.
FlexiChains can also be used with AlgebraOfGraphics.jl via the Tables.jl interface.
Available functions
Here is an overview of what is currently available:
| Type of plot | Makie.jl | Plots.jl |
|---|---|---|
| Trace + mixed density (default) | ✅ Makie.plot | ✅ Plots.plot |
| Trace plots | ✅ FlexiChains.Makie.traceplot | ✅ FlexiChains.Plots.traceplot |
| Density plots | ✅ Makie.density | ✅ Plots.density |
| Histograms | ✅ Makie.hist and Makie.stephist | ✅ Plots.histogram |
| Mixed density plots | ✅ FlexiChains.Makie.mixeddensity | ✅ FlexiChains.Plots.mixeddensity |
| Running mean plots | ✅ FlexiChains.Makie.meanplot | ✅ FlexiChains.Plots.meanplot |
| Autocorrelation plots | ✅ FlexiChains.Makie.autocorplot | ✅ FlexiChains.Plots.autocorplot |
| Rank plots | ✅ FlexiChains.Makie.rankplot | ✅ FlexiChains.Plots.rankplot |
| Corner plots | ✅ PairPlots.pairplot | ✅ StatsPlots.cornerplot |
| Violin plots | ✅ Makie.violin | ✅ StatsPlots.violin |
| Energy plots | 🐌 | 🐌 |
| Forest plots | ✅ FlexiChains.Makie.forestplot | 🐌 |
| Ridgeline plots | ✅ FlexiChains.Makie.ridgeline | 🐌 |
| Pushforward plots | ✅ FlexiChains.Makie.pushforward_continuous, FlexiChains.Makie.pushforward_discrete, and FlexiChains.Makie.pushforward_hist | 🐌 |
All of the above functions have 'mutating' versions with a ! suffix.
Notice that FlexiChains provides separate functions for Plots.jl and Makie.jl backends, which are namespaced within the FlexiChains.Plots and FlexiChains.Makie modules, respectively. This is necessary for disambiguation, much like how Plots.plot() and Makie.plot() are different functions.
Compositionality
In general, the plotting interfaces in FlexiChains try to stay as close as possible to the way the original plotting libraries work. That means that you should be able to construct your own plots, insert a FlexiChains plot into a larger figure, and so on, using the interface provided by the original plotting library.
For example, with Makie you can do something like:
# Set up a Makie figure
f = Makie.Figure()
# These functions provided / extended by FlexiChains
FlexiChains.Makie.traceplot!(f[1, 1], chn, param1)
Makie.density!(f[1, 2], chn, param2)
# This is some completely external Makie.jl plot
Makie.plot!(f[1, 3], randn(10, 10))
# Show the figure
fAnd with Plots.jl you can do:
# These functions provided / extended by FlexiChains
p1 = FlexiChains.Plots.traceplot(chn, param1)
p2 = Plots.density(chn, param2)
# This is some completely external Plots.jl plot
p3 = Plots.plot(randn(10, 10))
# Compose them with Plots.jl
plot([p1, p2, p3], layout=(3, 1))