Add keyword isedges::Bool = false to function heatmap_edges
Add the keyword `isedges::Bool` to the functions `heatmap_edges` and `_heatmap_edges`. Default is `false`. If `true`, the functions treat the given vector `v` as edges and not as midpoints.
This commit is contained in:
parent
8a9e963d92
commit
7c5b7b09c2
@ -342,8 +342,9 @@ const _scale_base = Dict{Symbol, Real}(
|
|||||||
:ln => ℯ,
|
:ln => ℯ,
|
||||||
)
|
)
|
||||||
|
|
||||||
function _heatmap_edges(v::AVec)
|
function _heatmap_edges(v::AVec, isedges::Bool = false)
|
||||||
length(v) == 1 && return v[1] .+ [-0.5, 0.5]
|
length(v) == 1 && return v[1] .+ [-0.5, 0.5]
|
||||||
|
if isedges return v end
|
||||||
vmin, vmax = ignorenan_extrema(v)
|
vmin, vmax = ignorenan_extrema(v)
|
||||||
extra_min = (v[2] - v[1]) / 2
|
extra_min = (v[2] - v[1]) / 2
|
||||||
extra_max = (v[end] - v[end - 1]) / 2
|
extra_max = (v[end] - v[end - 1]) / 2
|
||||||
@ -351,9 +352,9 @@ function _heatmap_edges(v::AVec)
|
|||||||
end
|
end
|
||||||
|
|
||||||
"create an (n+1) list of the outsides of heatmap rectangles"
|
"create an (n+1) list of the outsides of heatmap rectangles"
|
||||||
function heatmap_edges(v::AVec, scale::Symbol = :identity)
|
function heatmap_edges(v::AVec, scale::Symbol = :identity; isedges::Bool = false)
|
||||||
f, invf = scalefunc(scale), invscalefunc(scale)
|
f, invf = scalefunc(scale), invscalefunc(scale)
|
||||||
map(invf, _heatmap_edges(map(f,v)))
|
map(invf, _heatmap_edges(map(f,v), isedges))
|
||||||
end
|
end
|
||||||
|
|
||||||
function convert_to_polar(theta, r, r_extrema = ignorenan_extrema(r))
|
function convert_to_polar(theta, r, r_extrema = ignorenan_extrema(r))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user