Skip to content

Commit

Permalink
fix groupby with heatmap plot
Browse files Browse the repository at this point in the history
  • Loading branch information
joshday committed May 21, 2024
1 parent ccc3d20 commit 07a99e1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/OnlineStats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ include("viz/khist.jl")
include("viz/khist2d.jl")
include("viz/partition.jl")
include("viz/mosaicplot.jl")
include("viz/recipes.jl")
include("viz/heatmap.jl")
include("viz/recipes.jl")
include("viz/hexlattice.jl")
include("viz/ash.jl")
end
2 changes: 1 addition & 1 deletion src/stats/histograms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ counts(o::ExpandingHist) = o.counts
edges(o::ExpandingHist) = o.edges

function _fit!(o::ExpandingHist, y)
isfinite(y) || error("ExpandingHist requires finite values. Found $y.")
isfinite(y) || error("ExpandingHist requires `isfinite` values. Found $y.")
o.n += 1

# init
Expand Down
15 changes: 14 additions & 1 deletion src/viz/recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ end
end

#-----------------------------------------------------------------------# GroupBy
@recipe function f(o::GroupBy{<:Any, <:Any, <:Union{KHist, ExpandingHist, Hist}})
@recipe function f(o::GroupBy{<:Any, <:Any, <:Union{KHist, ExpandingHist, Hist, HeatMap}})
sort!(o.value)
link --> :all
for (k, v) in pairs(o.value)
Expand All @@ -81,6 +81,19 @@ end
end
end
end
@recipe function f(o::GroupBy{<:Any, <:Any, <:HeatMap})
sort!(o.value)
link --> :all
layout --> length(o.value)
for (i, (k, v)) in enumerate(pairs(o.value))
@series begin
subplot --> i
marginals --> false
title --> string(k)
v
end
end
end
@recipe function f(o::GroupBy)
sort!(o.value)
link --> :all
Expand Down

0 comments on commit 07a99e1

Please sign in to comment.