From da8bb5063e34e6d898a2cd29f9bc130fc0bd54d5 Mon Sep 17 00:00:00 2001 From: David Nies Date: Sat, 5 Oct 2019 17:46:06 +0200 Subject: [PATCH] Add histogram2d with log10 bins This is a draft yet that is missing some important features. --- src/recipes.jl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/recipes.jl b/src/recipes.jl index 1c3528e8..43e24360 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -777,6 +777,24 @@ end @deps histogram2d bins2d +@recipe function f(::Type{Val{:histogram2d_log10}}, x, y, z) + h = _make_hist((x, y), plotattributes[:bins], normed = plotattributes[:normalize], weights = plotattributes[:weights]) + x := h.edges[1] + y := h.edges[2] + + transform(x) = x == 0 ? NaN : log10(x) + + z := Surface(transform.(h.weights)) + + # TODO: doc + legend := false + seriestype := :bins2d + () +end +@shorthands histogram2d_log10 +@deps histogram2d_log bins2d + + @recipe function f(h::StatsBase.Histogram{T, 2, E}) where {T, E} seriestype --> :bins2d (h.edges[1], h.edges[2], Surface(h.weights))