diff --git a/src/backends/immerse.jl b/src/backends/immerse.jl index a3578a2b..f8e6171d 100644 --- a/src/backends/immerse.jl +++ b/src/backends/immerse.jl @@ -8,6 +8,7 @@ immerse!() = plotter!(:immerse) function createImmerseFigure(d::Dict) # d[:show] || return # return nothing when we're not showing + println("Creating immerse figure: ", d) w,h = d[:size] figidx = Immerse.figure(; name = d[:windowtitle], width = w, height = h) Immerse.Figure(figidx) @@ -22,7 +23,9 @@ function plot(pkg::ImmersePackage; kw...) gplt = createGadflyPlotObject(d) # create the figure (or not). Immerse just returns the index of the Figure in the GadflyDisplay... call Figure(figidx) to get the object - fig = d[:show] ? createImmerseFigure(d) : nothing + # fig = d[:show] ? createImmerseFigure(d) : nothing + fig = nothing + # if d[:show] # # w,h = d[:size] # # figidx = Immerse.figure(; name = d[:windowtitle], width = w, height = h) @@ -51,6 +54,7 @@ function Base.display(::ImmersePackage, plt::Plot) fig, gplt = plt.o if fig == nothing fig = createImmerseFigure(plt.initargs) + plt.o = (fig, gplt) end newfig = Immerse.Figure(fig.canvas, gplt) display(newfig) @@ -78,7 +82,8 @@ function buildSubplotObject!(::ImmersePackage, subplt::Subplot) end gctx = Gadfly.vstack(rows...) - fig = subplt.initargs[:show] ? createImmerseFigure(subplt.initargs) : nothing + # fig = subplt.initargs[:show] ? createImmerseFigure(subplt.initargs) : nothing + fig = nothing # fig = createImmerseFigure(subplt.initargs) subplt.o = (fig, gctx) @@ -87,13 +92,21 @@ end function Base.display(::ImmersePackage, subplt::Subplot) println("disp2") - # display(subplt.o[1]) + fig, gctx = subplt.o if fig == nothing fig = createImmerseFigure(subplt.initargs) + subplt.o = (fig, gctx) end - # newfig = Immerse.Figure(fig.canvas, gctx) - fig.cc = gctx - # error(fig) - display(fig) + + 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) end diff --git a/src/plot.jl b/src/plot.jl index d60e51e5..5fe0350d 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -112,11 +112,12 @@ function plot!(plt::Plot, args...; kw...) currentPlot!(plt) - # do we want to show it? - d = Dict(kw) - if haskey(d, :show) && d[:show] - display(plt) - end + # NOTE: lets ignore the show param and effectively use the semicolon at the end of the REPL statement + # # do we want to show it? + # d = Dict(kw) + # if haskey(d, :show) && d[:show] + # display(plt) + # end plt end diff --git a/src/subplot.jl b/src/subplot.jl index 8685857c..2a4d64a0 100644 --- a/src/subplot.jl +++ b/src/subplot.jl @@ -72,13 +72,13 @@ function subplot(args...; kw...) # initialize the individual plots pkg = plotter() tmpd = getPlotKeywordArgs(kw, 1, 0) - shouldShow = tmpd[:show] - tmpd[:show] = false + # shouldShow = tmpd[:show] + # tmpd[:show] = false plts = Plot[plot(pkg; tmpd...) for i in 1:length(layout)] - tmpd[:show] = shouldShow + # tmpd[:show] = shouldShow # create the object and do the plotting - subplt = Subplot(nothing, plts, pkg, length(layout), 0, layout, tmpd) + subplt = Subplot(nothing, plts, pkg, length(layout), 0, layout, tmpd, false) subplot!(subplt, args...; kw...) subplt @@ -111,17 +111,22 @@ function subplot!(subplt::Subplot, args...; kw...) end # create the underlying object (each backend will do this differently) - buildSubplotObject!(subplt.plotter, subplt) + if !subplt.initialized + buildSubplotObject!(subplt.plotter, subplt) + subplt.initialized = true + end # set this to be current currentPlot!(subplt) - # do we want to show it? - d = Dict(kw) - @show d - if haskey(d, :show) && d[:show] - display(subplt) - end + # NOTE: lets ignore the show param and effectively use the semicolon at the end of the REPL statement + # # do we want to show it? + # d = Dict(kw) + # @show d + # if haskey(d, :show) && d[:show] + # println("here...why?") + # display(subplt) + # end subplt end diff --git a/src/types.jl b/src/types.jl index d5d1c7e0..e4cf9115 100644 --- a/src/types.jl +++ b/src/types.jl @@ -30,4 +30,5 @@ type Subplot <: PlottingObject n::Int # number of series layout::SubplotLayout initargs::Dict + initialized::Bool end \ No newline at end of file