working on subplot

This commit is contained in:
Thomas Breloff 2015-09-11 15:17:40 -04:00
parent 36047e2928
commit fb2561e7e5
2 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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