add methods for matrices of annotations
This commit is contained in:
parent
6e00be5840
commit
3288e742bb
@ -474,6 +474,11 @@ mutable struct SeriesAnnotations
|
|||||||
baseshape::Union{Shape, AbstractVector{Shape}, Nothing}
|
baseshape::Union{Shape, AbstractVector{Shape}, Nothing}
|
||||||
scalefactor::Tuple
|
scalefactor::Tuple
|
||||||
end
|
end
|
||||||
|
|
||||||
|
series_annotations(scalar) = series_annotations([scalar])
|
||||||
|
function series_annotations(anns::AMat)
|
||||||
|
map(series_annotations, anns)
|
||||||
|
end
|
||||||
function series_annotations(strs::AbstractVector, args...)
|
function series_annotations(strs::AbstractVector, args...)
|
||||||
fnt = font()
|
fnt = font()
|
||||||
shp = nothing
|
shp = nothing
|
||||||
@ -570,6 +575,7 @@ end
|
|||||||
|
|
||||||
annotations(::Nothing) = []
|
annotations(::Nothing) = []
|
||||||
annotations(anns::AVec) = anns
|
annotations(anns::AVec) = anns
|
||||||
|
annotations(anns::AMat) = map(annotations, anns)
|
||||||
annotations(anns) = Any[anns]
|
annotations(anns) = Any[anns]
|
||||||
annotations(sa::SeriesAnnotations) = sa
|
annotations(sa::SeriesAnnotations) = sa
|
||||||
|
|
||||||
|
|||||||
@ -141,11 +141,11 @@ end
|
|||||||
layout = (5, 1),
|
layout = (5, 1),
|
||||||
ylims = (-1.1, 1.1),
|
ylims = (-1.1, 1.1),
|
||||||
xlims = (0, 5),
|
xlims = (0, 5),
|
||||||
series_annotations = ["1/1" "1/2" "1/3" "1/4" "1/5"],
|
series_annotations = permutedims([["1/1"],["1/2"],["1/3"],["1/4"],["1/5"]]),
|
||||||
)
|
)
|
||||||
@test spl.series_list[1].plotattrubtes[:series_annotations].strs == ["1/1"]
|
@test spl.series_list[1].plotattributes[:series_annotations].strs == ["1/1"]
|
||||||
@test spl.series_list[2].plotattrubtes[:series_annotations].strs == ["1/2"]
|
@test spl.series_list[2].plotattributes[:series_annotations].strs == ["1/2"]
|
||||||
@test spl.series_list[3].plotattrubtes[:series_annotations].strs == ["1/3"]
|
@test spl.series_list[3].plotattributes[:series_annotations].strs == ["1/3"]
|
||||||
@test spl.series_list[4].plotattrubtes[:series_annotations].strs == ["1/4"]
|
@test spl.series_list[4].plotattributes[:series_annotations].strs == ["1/4"]
|
||||||
@test spl.series_list[5].plotattrubtes[:series_annotations].strs == ["1/5"]
|
@test spl.series_list[5].plotattributes[:series_annotations].strs == ["1/5"]
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user