Skip to content

Commit

Permalink
add Plots.jl plotting of kde objects
Browse files Browse the repository at this point in the history
  • Loading branch information
marius311 committed Sep 12, 2023
1 parent d8dd7c1 commit fcb13c6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/CMBLensing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ include("masking.jl")
include("taylens.jl")
include("bilinearlens.jl")

# plotting
include("plots.jl")

# PPL
include("distributions.jl")
include("simpleppl.jl")
Expand All @@ -158,6 +155,9 @@ include("maximization.jl")
include("sampling.jl")
include("chains.jl")

# plotting
include("plots.jl")

# deprecated stuff
include("deprecated.jl")

Expand Down
20 changes: 20 additions & 0 deletions src/plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,24 @@ end

@recipe function plot(Cℓ::Cℓs)
(Cℓ.ℓ, Cℓ.Cℓ)
end

@recipe function plot(k::GetDistKDE{2}; clevels=[0.95,0.68], filled=false)

if filled
seriestype := :contourf
levels := [PyArray(k.kde.getContourLevels(clevels)); prevfloat(Inf)]
alpha := 0.5
else
seriestype := :contour
levels := PyArray(k.kde.getContourLevels(clevels))
end
cbar := false

return PyArray(k.kde.x), PyArray(k.kde.y), PyArray(k.kde.P)

end

@recipe function plot(k::GetDistKDE{1}; transform=identity)
(PyArray(k.kde.x), transform.(PyArray(k.kde.P)))
end

0 comments on commit fcb13c6

Please sign in to comment.