allow tuples
This commit is contained in:
parent
6dba32bf99
commit
5a7ed24078
@ -509,6 +509,13 @@ end
|
|||||||
# nothing
|
# nothing
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
splittable_kw(key, val, lengthGroup) = false
|
||||||
|
splittable_kw(key, val::AbstractArray, lengthGroup) = (key != :group) && size(val,1) == lengthGroup
|
||||||
|
splittable_kw(key, val::Tuple, lengthGroup) = all(splittable_kw.(key, val, lengthGroup))
|
||||||
|
|
||||||
|
split_kw(key, val::AbstractArray, indices) = val[indices, fill(Colon(), ndims(val)-1)...]
|
||||||
|
split_kw(key, val::Tuple, indices) = Tuple(split_kw(key, v, indices) for v in val)
|
||||||
|
|
||||||
# split the group into 1 series per group, and set the label and idxfilter for each
|
# split the group into 1 series per group, and set the label and idxfilter for each
|
||||||
@recipe function f(groupby::GroupBy, args...)
|
@recipe function f(groupby::GroupBy, args...)
|
||||||
lengthGroup = maximum(union(groupby.groupIds...))
|
lengthGroup = maximum(union(groupby.groupIds...))
|
||||||
@ -517,9 +524,8 @@ end
|
|||||||
label --> string(glab)
|
label --> string(glab)
|
||||||
idxfilter --> groupby.groupIds[i]
|
idxfilter --> groupby.groupIds[i]
|
||||||
for (key,val) in d
|
for (key,val) in d
|
||||||
if key != :group && isa(val, AbstractArray) && size(val,1) >= lengthGroup
|
if splittable_kw(key, val, lengthGroup)
|
||||||
n = ndims(val)
|
:($key) := split_kw(key, val, groupby.groupIds[i])
|
||||||
:($key) := val[groupby.groupIds[i], fill(Colon(), n-1)...]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
args
|
args
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user