* Fix vline, histogram, barhist, stephist axis letter * Fix vspan + move vline y values to shorthands * Fix histograms with @one_arg_shorthands + fix vspan * Add tests for axis letter * move swap to _plot * use RecipesBase approach * restore formatters * fix and format pgfx-tests * update compat * Update precompile_*.jl file (#2982) Co-authored-by: BeastyBlacksmith <BeastyBlacksmith@users.noreply.github.com> Co-authored-by: Benoit Pasquier <briochemc@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: BeastyBlacksmith <BeastyBlacksmith@users.noreply.github.com>
26 lines
906 B
Julia
26 lines
906 B
Julia
using Plots, Test
|
|
|
|
@testset "axis letter" begin
|
|
using Plots, RecipesBase
|
|
# a custom type for dispacthing the axis-letter-testing recipe
|
|
struct MyType <: Number
|
|
val::Float64
|
|
end
|
|
value(m::MyType) = m.val
|
|
data = MyType.(sort(randn(20)))
|
|
# A recipe that puts the axis letter in the title
|
|
@recipe function f(::Type{T}, m::T) where T <: AbstractArray{<:MyType}
|
|
title --> string(plotattributes[:letter])
|
|
value.(m)
|
|
end
|
|
@testset "$f (orientation = $o)" for f in [histogram, barhist, stephist, scatterhist], o in [:vertical, :horizontal]
|
|
@test f(data, orientation=o).subplots[1].attr[:title] == (o == :vertical ? "x" : "y")
|
|
end
|
|
@testset "$f" for f in [hline, hspan]
|
|
@test f(data).subplots[1].attr[:title] == "y"
|
|
end
|
|
@testset "$f" for f in [vline, vspan]
|
|
@test f(data).subplots[1].attr[:title] == "x"
|
|
end
|
|
end
|