working on groups and iris notebook

This commit is contained in:
Thomas Breloff 2015-09-23 16:48:49 -04:00
parent 75f4ca928f
commit e3612b973f
3 changed files with 328 additions and 10 deletions

315
examples/iris.ipynb Normal file

File diff suppressed because one or more lines are too long

View File

@ -215,6 +215,7 @@ const _keyAliases = Dict(
:windowsize => :size,
:wsize => :size,
:wtitle => :windowtitle,
:gui => :show,
:display => :show,
)
@ -255,15 +256,17 @@ end
"A special type that will break up incoming data into groups, and allow for easier creation of grouped plots"
type GroupBy
numGroups::Int
numPoints::Int
groupLabels::Vector{UTF8String} # length == numGroups
groupIds::Vector{Int} # length == numPoints
groupIds::Vector{Vector{Int}} # list of indices for each group
end
function extractGroupArgs(d::Dict)
# expecting a mapping of "group label" to "group indices"
# expecting a mapping of "group label" to "group indices"
function extractGroupArgs{V<:AVec{Int}}(d::Dict{T,V})
numGroups = length(d)
groupLabels = sortedkeys(d)
groupIds = VecI[collect(d[k]) for k in groupLabels]
GroupBy(numGroups, groupLabels, groupIds)
end

View File

@ -96,7 +96,7 @@ function plot!(plt::Plot, args...; kw...)
# get the list of dictionaries, one per series
kwList, xmeta, ymeta = createKWargsList(plt, groupargs..., args...; d...)
@show xmeta ymeta typeof(xmeta) typeof(ymeta)
# @show xmeta ymeta typeof(xmeta) typeof(ymeta)
# if we were able to extract guide information from the series inputs, then update the plot
updateDictWithMeta(d, plt.initargs, xmeta, true)
@ -114,9 +114,9 @@ function plot!(plt::Plot, args...; kw...)
# NOTE: lets ignore the show param and effectively use the semicolon at the end of the REPL statement
# # do we want to show it?
# if haskey(d, :show) && d[:show]
# display(plt)
# end
if haskey(d, :show) && d[:show]
gui()
end
plt
end
@ -261,7 +261,7 @@ function createKWargsList(plt::PlottingObject; kw...)
d = Dict(kw)
if !haskey(d, :y)
# assume we just want to create an empty plot object which can be added to later
return []
return [], nothing, nothing
# error("Called plot/subplot without args... must set y in the keyword args. Example: plot(; y=rand(10))")
end