wip groupedbar
This commit is contained in:
parent
cc15882faf
commit
6c548f025e
@ -519,16 +519,31 @@ split_kw(key, val::Tuple, indices) = Tuple(split_kw(key, v, indices) for v in va
|
|||||||
# 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...))
|
||||||
for (i,glab) in enumerate(groupby.groupLabels)
|
if !(RecipesBase.group_as_matrix(args[1]))
|
||||||
@series begin
|
for (i,glab) in enumerate(groupby.groupLabels)
|
||||||
label --> string(glab)
|
@series begin
|
||||||
idxfilter --> groupby.groupIds[i]
|
label --> string(glab)
|
||||||
for (key,val) in d
|
idxfilter --> groupby.groupIds[i]
|
||||||
if splittable_kw(key, val, lengthGroup)
|
for (key,val) in d
|
||||||
:($key) := split_kw(key, val, groupby.groupIds[i])
|
if splittable_kw(key, val, lengthGroup)
|
||||||
|
:($key) := split_kw(key, val, groupby.groupIds[i])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
args
|
||||||
end
|
end
|
||||||
args
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
g = args[1]
|
||||||
|
x, y = g.args
|
||||||
|
x_u = unique(x)
|
||||||
|
y_mat = Array{eltype(y)}(length(x_u), length(groupby.groupLabels))
|
||||||
|
for i in 1:length(groupby.groupLabels)
|
||||||
|
xi = x[groupby.groupIds[i]]
|
||||||
|
yi = y[groupby.groupIds[i]]
|
||||||
|
x2y = Dict(zip(xi,yi))
|
||||||
|
y_mat[:, i] = [get(x2y, s, NaN) for s in x_u]
|
||||||
|
end
|
||||||
|
label --> reshape(groupby.groupLabels, 1, :)
|
||||||
|
typeof(g)((x_u, y_mat))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user