-
-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Histogram: fix a bug when data changes to allequal values
When plotting Observables if the contained collection changed such that all values were equal the minimum and maximum values would match causing pick_hist_edges to return a vector. This in turn would result in a conversion error if the previous value was a range. This is fixed by simply returning a range instead. Fixes #2452
- Loading branch information
Showing
3 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,5 @@ using Makie: volume | |
include("PolarAxis.jl") | ||
include("barplot.jl") | ||
include("bezier.jl") | ||
include("hist.jl") | ||
end |