Plotting grids
AdaptiveDensityApproximationRecipes.jl
defines plotting recipes for Plots.jl
, providing simple visualizations for 2-dim Grid
objects and OneDimGrid
objects.
If the registry Translational-Pain-Julia-Registry
is installed, AdaptiveDensityApproximationRecipes.jl
can be installed like any other package
using Pkg
Pkg.add("AdaptiveDensityApproximationRecipes")
Otherwise, install the Translational-Pain-Julia-Registry
first
using Pkg
Pkg.Registry.add()
Pkg.Registry.add(RegistrySpec(url = "https://github.com/Translational-Pain-Research/Translational-Pain-Julia-Registry"))
To illustrate the plotting of grids, a OneDimGrid
object and a Grid
object need to be constructed
using AdaptiveDensityApproximation
one_dim_grid = create_grid(LinRange(0,2*pi,20))
approximate_density!(one_dim_grid,sin)
two_dim_grid = create_grid(LinRange(0,2*pi,20),LinRange(0,2pi,20))
approximate_density!(two_dim_grid, x -> sin(x[1])^2 + cos(x[2])^2)
With AdaptiveDensityApproximationRecipes.jl
and Plots.jl
, the grids can easily be plotted
using AdaptiveDensityApproximationRecipes, Plots
plot(one_dim_grid)
plot(two_dim_grid)