try to support categorical arrays

This commit is contained in:
Daniel Schwabeneder 2020-03-28 20:46:07 +01:00
parent dd36d17fa6
commit 742d46cbbf
2 changed files with 12 additions and 4 deletions

View File

@ -53,12 +53,12 @@ julia = "1"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
GeometryTypes = "4d00f742-c7ba-57c2-abde-4428a4b178cb"
Gtk = "4c0ca9eb-093a-5379-98c5-f87ac0bbbf44"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

View File

@ -35,14 +35,22 @@ series_vector(n::Integer, plotattributes) = [zeros(0) for i in 1:n]
# vector of data points is a single series
series_vector(v::AVec{<:DataPoint}, plotattributes) = [prepareSeriesData(v)]
# vector of arrays
series_vector(v::AVec{<:AbstractArray}, plotattributes) =
vcat((series_vector(vi, plotattributes) for vi in v)...)
# list of things (maybe other vectors, functions, or something else)
function series_vector(v::AVec, plotattributes)
if all(x -> x isa MaybeNumber, v)
series_vector(Vector{MaybeNumber}(v), plotattributes)
return series_vector(Vector{MaybeNumber}(v), plotattributes)
elseif all(x -> x isa MaybeString, v)
series_vector(Vector{MaybeString}(v), plotattributes)
return series_vector(Vector{MaybeString}(v), plotattributes)
else
vcat((series_vector(vi, plotattributes) for vi in v)...)
try
series_vector(string.(v), plotattributes)
catch
vcat((series_vector(vi, plotattributes) for vi in v)...)
end
end
end