From fb2561e7e51eceda8a37773dc190ae25be9da670 Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Fri, 11 Sep 2015 15:17:40 -0400 Subject: [PATCH] working on subplot --- src/qwt.jl | 10 +++++++++- src/subplot.jl | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/qwt.jl b/src/qwt.jl index 0b4e0c95..571207ae 100644 --- a/src/qwt.jl +++ b/src/qwt.jl @@ -48,7 +48,15 @@ savepng(::QwtPackage, plt::PlottingObject, fn::String, args...) = Qwt.savepng(pl # o = buildSubplotObject(plts, pkg, layout) function buildSubplotObject(plts::Vector{Plot}, pkg::QwtPackage, layout::SubplotLayout) - Qwt.vsplitter([Qwt.hsplitter([plt.o for plt in plts[i:(i+rowcnt-1)]]...) for rowcnt in layout.rowcounts]...) + @show plts pkg layout + i = 0 + rows = [] + for rowcnt in layout.rowcounts + push!(rows, Qwt.hsplitter([plt.o for plt in plts[(1:rowcnt) + i]]...)) + i += rowcnt + end + @show rows + Qwt.vsplitter(rows...) end diff --git a/src/subplot.jl b/src/subplot.jl index 9caeb3c1..e0909e21 100644 --- a/src/subplot.jl +++ b/src/subplot.jl @@ -58,13 +58,13 @@ function subplot(args...; kw...) d = Dict(kw) # figure out the layout - if !haskey(d, :layout) - layout = FixedLayout(d[:layout]) + if haskey(d, :layout) + layout = SubplotLayout(d[:layout]) else if !haskey(d, :n) error("You must specify either layout or n when creating a subplot: ", d) end - layout = AutoGridLayout(d[:n], get(d, :numrows, -1), get(d, :numcols, -1)) + layout = SubplotLayout(d[:n], get(d, :numrows, -1), get(d, :numcols, -1)) end # initialize the individual plots