alow heatmap of nx1 or 1xn matrices

This commit is contained in:
Daniel Schwabeneder 2018-10-30 09:02:58 +01:00
parent 45b5b33929
commit 5396477082
2 changed files with 3 additions and 2 deletions

View File

@ -614,7 +614,7 @@ function _update_min_padding!(sp::Subplot{GRBackend})
rightpad += 4mm
else
leftpad += 4mm
end
end
end
if sp[:colorbar_title] != ""
rightpad += 4mm
@ -671,7 +671,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas)
outside_ticks = true
for ax in (sp[:xaxis], sp[:yaxis])
v = series[ax[:letter]]
if diff(collect(extrema(diff(v))))[1] > 1e-6*std(v)
if length(v) > 1 && diff(collect(extrema(diff(v))))[1] > 1e-6*std(v)
@warn("GR: heatmap only supported with equally spaced data.")
end
end

View File

@ -357,6 +357,7 @@ const _scale_base = Dict{Symbol, Real}(
)
function _heatmap_edges(v::AVec)
length(v) == 1 && return v[1] .+ [-0.5, 0.5]
vmin, vmax = ignorenan_extrema(v)
extra_min = (v[2] - v[1]) / 2
extra_max = (v[end] - v[end - 1]) / 2