Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary fix to unit test error #56

Merged
merged 1 commit into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/mod/Visualizations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,9 @@ function wiggle!(plt::Plots.Plot,
# generate the desired plots as of O3/19/2018. Somehow, the relative value of 0,
# i.e., fillrange=0, works well, which is used temporarily.
if Orient == :down
plot!(plt, inputy, inputx, fillrange=0, fillalpha=0.75,
fillcolor=FaceColor, linecolor=EdgeColor, orientation=:v)
plot!(plt, inputy, inputx, fillrange=0, fillalpha=0.75, fillcolor=FaceColor, linecolor=EdgeColor, orientation=:v)
else
plot!(plt, inputx, inputy, fillrange=0, fillalpha=0.75,
fillcolor=FaceColor, linecolor=EdgeColor)
plot!(plt, inputx, inputy, fillrange=0, fillalpha=0.75, fillcolor=FaceColor, linecolor=EdgeColor)
end
end
return plt
Expand Down
90 changes: 48 additions & 42 deletions test/visualizations.jl
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
tree = BitVector([1,1,1])
@test Visualizations.treenodes_matrix(tree) == BitArray([1 1; 1 1])
# plot_tfbdry() test
p = plot()
@test isa(plot_tfbdry(tree), Plots.Plot{Plots.GRBackend})
@test isa(plot_tfbdry(p, tree), Plots.Plot{Plots.GRBackend})
@test isa(plot_tfbdry!(tree), Plots.Plot{Plots.GRBackend})
@test isa(plot_tfbdry!(p, tree), Plots.Plot{Plots.GRBackend})
@test_nowarn plot_tfbdry(tree, start=1)
@test_throws AssertionError plot_tfbdry(tree, start=2)
@test_nowarn plot_tfbdry(tree, node_color=:red, background_color=:white, line_color=:black)
# plot_tfbdry2() test
tree = maketree(4,4,2,:dwt)
p = plot()
@test isa(plot_tfbdry2(tree), Plots.Plot{Plots.GRBackend})
@test isa(plot_tfbdry2(p, tree), Plots.Plot{Plots.GRBackend})
@test isa(plot_tfbdry2!(tree), Plots.Plot{Plots.GRBackend})
@test isa(plot_tfbdry2!(p, tree), Plots.Plot{Plots.GRBackend})
@test_nowarn plot_tfbdry2(tree)
@test_nowarn plot_tfbdry2(tree, 4)
@test_nowarn plot_tfbdry2(tree, 4, 8)
@test_throws AssertionError plot_tfbdry2(tree, 3, 8)
@test_throws AssertionError plot_tfbdry2(tree, 4, 3)
@test_throws AssertionError plot_tfbdry2(tree, 6, 6)
x = randn(16,5)
# wiggle() test
@test typeof(wiggle(x)) == Plots.Plot{Plots.GRBackend}
p = plot()
@test typeof(wiggle(p, x)) == Plots.Plot{Plots.GRBackend}
# wiggle!() test
@test typeof(wiggle!(x)) == Plots.Plot{Plots.GRBackend}
@test typeof(wiggle!(p, x)) == Plots.Plot{Plots.GRBackend}
@test_throws ErrorException("Inconsistent taxis dimension!") wiggle!(p, x, taxis=1:5)
@test_throws ErrorException("Inconsistent zaxis dimension!") wiggle!(p, x, zaxis=1:4)
@test_nowarn wiggle!(p, x, sc=0.3)
@test_nowarn wiggle!(p, x, EdgeColor=:red)
@test_nowarn wiggle!(p, x, FaceColor=:red)
@test_nowarn wiggle!(p, x, Overlap=false)
@test_nowarn wiggle!(p, x, Orient=:down)
@test_throws AssertionError wiggle!(p, x, Orient=:fail)
@test_nowarn wiggle!(p, x, ZDir=:reverse)
@test_throws AssertionError wiggle!(p, x, ZDir=:fail)
@testset "plot_tfbdry" begin
tree = BitVector([1,1,1])
@test Visualizations.treenodes_matrix(tree) == BitArray([1 1; 1 1])
p = plot()
@test isa(plot_tfbdry(tree), Plots.Plot{Plots.GRBackend})
@test isa(plot_tfbdry(p, tree), Plots.Plot{Plots.GRBackend})
@test isa(plot_tfbdry!(tree), Plots.Plot{Plots.GRBackend})
@test isa(plot_tfbdry!(p, tree), Plots.Plot{Plots.GRBackend})
@test_nowarn plot_tfbdry(tree, start=1)
@test_throws AssertionError plot_tfbdry(tree, start=2)
@test_nowarn plot_tfbdry(tree, node_color=:red, background_color=:white, line_color=:black)
end

@testset "plot_tfbdry2" begin
tree = maketree(4,4,2,:dwt)
p = plot()
@test isa(plot_tfbdry2(tree), Plots.Plot{Plots.GRBackend})
@test isa(plot_tfbdry2(p, tree), Plots.Plot{Plots.GRBackend})
@test isa(plot_tfbdry2!(tree), Plots.Plot{Plots.GRBackend})
@test isa(plot_tfbdry2!(p, tree), Plots.Plot{Plots.GRBackend})
@test_nowarn plot_tfbdry2(tree)
@test_nowarn plot_tfbdry2(tree, 4)
@test_nowarn plot_tfbdry2(tree, 4, 8)
@test_throws AssertionError plot_tfbdry2(tree, 3, 8)
@test_throws AssertionError plot_tfbdry2(tree, 4, 3)
@test_throws AssertionError plot_tfbdry2(tree, 6, 6)
end

@testset "wiggle" begin
x = randn(16,5)
# wiggle() test
@test typeof(wiggle(x)) == Plots.Plot{Plots.GRBackend}
p = plot()
@test typeof(wiggle(p, x)) == Plots.Plot{Plots.GRBackend}
# wiggle!() test
@test typeof(wiggle!(x)) == Plots.Plot{Plots.GRBackend}
@test typeof(wiggle!(p, x)) == Plots.Plot{Plots.GRBackend}
@test_throws ErrorException("Inconsistent taxis dimension!") wiggle!(p, x, taxis=1:5)
@test_throws ErrorException("Inconsistent zaxis dimension!") wiggle!(p, x, zaxis=1:4)
@test_nowarn wiggle!(p, x, sc=0.3)
@test_nowarn wiggle!(p, x, EdgeColor=:red)
@test_nowarn wiggle!(p, x, FaceColor=:red)
@test_nowarn wiggle!(p, x, Overlap=false)
@test isa(wiggle!(p, x, Orient=:down), Plots.Plot{Plots.GRBackend}) # TODO: Keyword plot(orientation) deprecated. Figure out long term solution to this.
@test_throws AssertionError wiggle!(p, x, Orient=:fail)
@test_nowarn wiggle!(p, x, ZDir=:reverse)
@test_throws AssertionError wiggle!(p, x, ZDir=:fail)
end