From 1ff9292e90af0711a4418610cdf3726e824c9144 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Sun, 13 Oct 2024 18:39:39 +0200 Subject: [PATCH] add violin test --- src/violin.jl | 12 ++++++------ test/runtests.jl | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/violin.jl b/src/violin.jl index 74b930e..1ee4127 100644 --- a/src/violin.jl +++ b/src/violin.jl @@ -40,15 +40,15 @@ get_quantiles(n::Int) = range(0, 1, length = n + 2)[2:(end - 1)] ) # if only y is provided, then x will be UnitRange 1:size(y,2) if typeof(x) <: AbstractRange - if step(x) == first(x) == 1 - x = plotattributes[:series_plotindex] + x = if step(x) == first(x) == 1 + plotattributes[:series_plotindex] else - x = [getindex(x, plotattributes[:series_plotindex])] + [getindex(x, plotattributes[:series_plotindex])] end end - xsegs, ysegs = Segments(), Segments() - qxsegs, qysegs = Segments(), Segments() - mxsegs, mysegs = Segments(), Segments() + xsegs, ysegs = Plots.PlotsBase.Segments(), Plots.PlotsBase.Segments() + qxsegs, qysegs = Plots.PlotsBase.Segments(), Plots.PlotsBase.Segments() + mxsegs, mysegs = Plots.PlotsBase.Segments(), Plots.PlotsBase.Segments() glabels = sort(collect(unique(x))) bw = plotattributes[:bar_width] bw == nothing && (bw = 0.8) diff --git a/test/runtests.jl b/test/runtests.jl index c815e01..72e9d80 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -184,3 +184,9 @@ end pl = marginalscatter(rand(rng, 100), rand(rng, 100)) @test show(devnull, pl) isa Nothing end + +@testset "violin" begin + rng = StableRNG(1337) + pl = violin(repeat([.1, .2, .3], outer=100), randn(300), side=:right) + @test show(devnull, pl) isa Nothing +end \ No newline at end of file