Skip to content

Commit

Permalink
Merge branch 'master' into sd/beta-20
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch authored Nov 1, 2023
2 parents 8cff709 + c8458b7 commit 67102ff
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,12 @@ StructArrays = "0.3, 0.4, 0.5, 0.6"
TriplotBase = "=0.1.0"
UnicodeFun = "0.4"
julia = "1.3"
Base64 = "1.0, 1.6"
CRC32c = "1.0, 1.6"
InteractiveUtils = "1.0, 1.6"
LinearAlgebra = "1.0, 1.6"
Markdown = "1.0, 1.6"
Printf = "1.0, 1.6"
REPL = "1.0, 1.6"
Random = "1.0, 1.6"
SparseArrays = "1.0, 1.6"
2 changes: 1 addition & 1 deletion src/stats/hist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function pick_hist_edges(vals, bins)
if bins isa Int
mi, ma = float.(extrema(vals))
if mi == ma
return [mi - 0.5, ma + 0.5]
return (mi - 0.5):(ma + 0.5)
end
# hist is right-open, so to include the upper data point, make the last bin a tiny bit bigger
ma = nextfloat(ma)
Expand Down
16 changes: 16 additions & 0 deletions test/hist.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@testset "Histogram plotting" begin
unequal_vec = [1; rand(2:9, rand(1:9))]
allequal_vec = fill(rand(1:9), rand(1:9))
# normal range
@test_nowarn hist(0:rand(1:9))
# initialize with unequal observable vector
v = Observable(unequal_vec)
@test_nowarn hist(v)
# change to allequal vector
@test_nowarn v[] = allequal_vec
# initialize with allequal observable vector
v = Observable(allequal_vec)
@test_nowarn hist(v)
# change to unequal vector
@test_nowarn v[] = unequal_vec
end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ using Makie: volume
include("PolarAxis.jl")
include("barplot.jl")
include("bezier.jl")
include("hist.jl")
end

0 comments on commit 67102ff

Please sign in to comment.