working on groups and iris notebook
This commit is contained in:
parent
431d60a58a
commit
dbc90c9417
1645
examples/iris.ipynb
1645
examples/iris.ipynb
File diff suppressed because one or more lines are too long
14
src/args.jl
14
src/args.jl
@ -261,7 +261,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
# this is when given a vector-type of values to group by
|
# this is when given a vector-type of values to group by
|
||||||
function extractGroupArgs(v::AVec, d::Dict)
|
function extractGroupArgs(v::AVec, args...)
|
||||||
groupLabels = sort(collect(unique(v)))
|
groupLabels = sort(collect(unique(v)))
|
||||||
n = length(groupLabels)
|
n = length(groupLabels)
|
||||||
if n > 20
|
if n > 20
|
||||||
@ -273,23 +273,13 @@ end
|
|||||||
|
|
||||||
|
|
||||||
# expecting a mapping of "group label" to "group indices"
|
# expecting a mapping of "group label" to "group indices"
|
||||||
function extractGroupArgs{T, V<:AVec{Int}}(idxmap::Dict{T,V}, d::Dict)
|
function extractGroupArgs{T, V<:AVec{Int}}(idxmap::Dict{T,V}, args...)
|
||||||
groupLabels = sortedkeys(idxmap)
|
groupLabels = sortedkeys(idxmap)
|
||||||
groupIds = VecI[collect(idxmap[k]) for k in groupLabels]
|
groupIds = VecI[collect(idxmap[k]) for k in groupLabels]
|
||||||
GroupBy(groupLabels, groupIds)
|
GroupBy(groupLabels, groupIds)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# expecting the column name of a dataframe that was passed in... anything else should error
|
|
||||||
function extractGroupArgs(s::Symbol, d::Dict)
|
|
||||||
if haskey(d, :dataframe) && haskey(d[:dataframe], s)
|
|
||||||
return extractGroupArgs(d[:dataframe][s])
|
|
||||||
else
|
|
||||||
error("Got a symbol, and expected that to be a key in d[:dataframe]. s=$s d=$d")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
function warnOnUnsupportedArgs(pkg::PlottingPackage, d::Dict)
|
function warnOnUnsupportedArgs(pkg::PlottingPackage, d::Dict)
|
||||||
|
|||||||
11
src/plot.jl
11
src/plot.jl
@ -88,7 +88,7 @@ function plot!(plt::Plot, args...; kw...)
|
|||||||
# index partitions/filters to be passed through to the next step.
|
# index partitions/filters to be passed through to the next step.
|
||||||
# Ideally we don't change the insides ot createKWargsList too much to
|
# Ideally we don't change the insides ot createKWargsList too much to
|
||||||
# save from code repetition. We could consider adding a throw
|
# save from code repetition. We could consider adding a throw
|
||||||
groupargs = haskey(d, :group) ? [extractGroupArgs(d[:group], d)] : []
|
groupargs = haskey(d, :group) ? [extractGroupArgs(d[:group], args...)] : []
|
||||||
# @show groupargs
|
# @show groupargs
|
||||||
|
|
||||||
# just in case the backend needs to set up the plot (make it current or something)
|
# just in case the backend needs to set up the plot (make it current or something)
|
||||||
@ -303,6 +303,15 @@ function dataframes!()
|
|||||||
createKWargsList(plt, args...; kw..., dataframe = df)
|
createKWargsList(plt, args...; kw..., dataframe = df)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# expecting the column name of a dataframe that was passed in... anything else should error
|
||||||
|
@eval function extractGroupArgs(s::Symbol, df::DataFrames.DataFrame, args...)
|
||||||
|
if haskey(df, s)
|
||||||
|
return extractGroupArgs(df[s])
|
||||||
|
else
|
||||||
|
error("Got a symbol, and expected that to be a key in d[:dataframe]. s=$s d=$d")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@eval function getDataFrameFromKW(; kw...)
|
@eval function getDataFrameFromKW(; kw...)
|
||||||
for (k,v) in kw
|
for (k,v) in kw
|
||||||
if k == :dataframe
|
if k == :dataframe
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user