From dc1389bd1a186474fff4025523b03d960df3f28b Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Mon, 14 Sep 2015 15:24:18 -0400 Subject: [PATCH] working on immerse --- src/backends/immerse.jl | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/backends/immerse.jl b/src/backends/immerse.jl index 7698db96..79b1c524 100644 --- a/src/backends/immerse.jl +++ b/src/backends/immerse.jl @@ -61,17 +61,20 @@ end # ------------------------------- -# create the underlying object -function buildSubplotObject!(::ImmersePackage, subplt::Subplot) - - # create my Compose.Context grid by hstacking and vstacking the Gadfly.Plot objects +# create my Compose.Context grid by hstacking and vstacking the Gadfly.Plot objects +function buildGadflySubplotContext(subplt::Subplot) i = 0 rows = [] for rowcnt in subplt.layout.rowcounts push!(rows, Gadfly.hstack([plt.o[2] for plt in subplt.plts[(1:rowcnt) + i]]...)) i += rowcnt end - gctx = Gadfly.vstack(rows...) + Gadfly.vstack(rows...) +end + +# create the underlying object +function buildSubplotObject!(::ImmersePackage, subplt::Subplot) + gctx = buildGadflySubplotContext(subplt) # save this for later subplt.o = (nothing, gctx) @@ -87,16 +90,7 @@ function Base.display(::ImmersePackage, subplt::Subplot) subplt.o = (fig, gctx) end - # fig.prepped = Gadfly.render_prepare(gctx) - # # Render in the current state - # fig.cc = render_finish(fig.prepped; dynamic=false) - # # Render the figure - # display(fig.canvas, fig) - - fig.cc = gctx - # fig.prepped = nothing - - # display(fig.canvas, display(gctx)) - - display(fig) + newfig = Immerse.Figure(fig.canvas) + newfig.cc = buildGadflySubplotContext(subplt) + display(newfig) end