working on immerse
This commit is contained in:
parent
e6c8344970
commit
a33f5fabd1
@ -8,6 +8,7 @@ immerse!() = plotter!(:immerse)
|
|||||||
|
|
||||||
function createImmerseFigure(d::Dict)
|
function createImmerseFigure(d::Dict)
|
||||||
# d[:show] || return # return nothing when we're not showing
|
# d[:show] || return # return nothing when we're not showing
|
||||||
|
println("Creating immerse figure: ", d)
|
||||||
w,h = d[:size]
|
w,h = d[:size]
|
||||||
figidx = Immerse.figure(; name = d[:windowtitle], width = w, height = h)
|
figidx = Immerse.figure(; name = d[:windowtitle], width = w, height = h)
|
||||||
Immerse.Figure(figidx)
|
Immerse.Figure(figidx)
|
||||||
@ -22,7 +23,9 @@ function plot(pkg::ImmersePackage; kw...)
|
|||||||
gplt = createGadflyPlotObject(d)
|
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
|
# 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]
|
# if d[:show]
|
||||||
# # w,h = d[:size]
|
# # w,h = d[:size]
|
||||||
# # figidx = Immerse.figure(; name = d[:windowtitle], width = w, height = h)
|
# # figidx = Immerse.figure(; name = d[:windowtitle], width = w, height = h)
|
||||||
@ -51,6 +54,7 @@ function Base.display(::ImmersePackage, plt::Plot)
|
|||||||
fig, gplt = plt.o
|
fig, gplt = plt.o
|
||||||
if fig == nothing
|
if fig == nothing
|
||||||
fig = createImmerseFigure(plt.initargs)
|
fig = createImmerseFigure(plt.initargs)
|
||||||
|
plt.o = (fig, gplt)
|
||||||
end
|
end
|
||||||
newfig = Immerse.Figure(fig.canvas, gplt)
|
newfig = Immerse.Figure(fig.canvas, gplt)
|
||||||
display(newfig)
|
display(newfig)
|
||||||
@ -78,7 +82,8 @@ function buildSubplotObject!(::ImmersePackage, subplt::Subplot)
|
|||||||
end
|
end
|
||||||
gctx = Gadfly.vstack(rows...)
|
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)
|
# fig = createImmerseFigure(subplt.initargs)
|
||||||
|
|
||||||
subplt.o = (fig, gctx)
|
subplt.o = (fig, gctx)
|
||||||
@ -87,13 +92,21 @@ end
|
|||||||
|
|
||||||
function Base.display(::ImmersePackage, subplt::Subplot)
|
function Base.display(::ImmersePackage, subplt::Subplot)
|
||||||
println("disp2")
|
println("disp2")
|
||||||
# display(subplt.o[1])
|
|
||||||
fig, gctx = subplt.o
|
fig, gctx = subplt.o
|
||||||
if fig == nothing
|
if fig == nothing
|
||||||
fig = createImmerseFigure(subplt.initargs)
|
fig = createImmerseFigure(subplt.initargs)
|
||||||
|
subplt.o = (fig, gctx)
|
||||||
end
|
end
|
||||||
# newfig = Immerse.Figure(fig.canvas, gctx)
|
|
||||||
fig.cc = gctx
|
fig.prepped = Gadfly.render_prepare(gctx)
|
||||||
# error(fig)
|
# Render in the current state
|
||||||
display(fig)
|
fig.cc = render_finish(fig.prepped; dynamic=false)
|
||||||
|
# Render the figure
|
||||||
|
display(fig.canvas, fig)
|
||||||
|
|
||||||
|
# fig.cc = gctx
|
||||||
|
# fig.prepped = nothing
|
||||||
|
|
||||||
|
# display(fig)
|
||||||
end
|
end
|
||||||
|
|||||||
11
src/plot.jl
11
src/plot.jl
@ -112,11 +112,12 @@ function plot!(plt::Plot, args...; kw...)
|
|||||||
|
|
||||||
currentPlot!(plt)
|
currentPlot!(plt)
|
||||||
|
|
||||||
# do we want to show it?
|
# NOTE: lets ignore the show param and effectively use the semicolon at the end of the REPL statement
|
||||||
d = Dict(kw)
|
# # do we want to show it?
|
||||||
if haskey(d, :show) && d[:show]
|
# d = Dict(kw)
|
||||||
display(plt)
|
# if haskey(d, :show) && d[:show]
|
||||||
end
|
# display(plt)
|
||||||
|
# end
|
||||||
|
|
||||||
plt
|
plt
|
||||||
end
|
end
|
||||||
|
|||||||
@ -72,13 +72,13 @@ function subplot(args...; kw...)
|
|||||||
# initialize the individual plots
|
# initialize the individual plots
|
||||||
pkg = plotter()
|
pkg = plotter()
|
||||||
tmpd = getPlotKeywordArgs(kw, 1, 0)
|
tmpd = getPlotKeywordArgs(kw, 1, 0)
|
||||||
shouldShow = tmpd[:show]
|
# shouldShow = tmpd[:show]
|
||||||
tmpd[:show] = false
|
# tmpd[:show] = false
|
||||||
plts = Plot[plot(pkg; tmpd...) for i in 1:length(layout)]
|
plts = Plot[plot(pkg; tmpd...) for i in 1:length(layout)]
|
||||||
tmpd[:show] = shouldShow
|
# tmpd[:show] = shouldShow
|
||||||
|
|
||||||
# create the object and do the plotting
|
# 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...)
|
subplot!(subplt, args...; kw...)
|
||||||
|
|
||||||
subplt
|
subplt
|
||||||
@ -111,17 +111,22 @@ function subplot!(subplt::Subplot, args...; kw...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# create the underlying object (each backend will do this differently)
|
# 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
|
# set this to be current
|
||||||
currentPlot!(subplt)
|
currentPlot!(subplt)
|
||||||
|
|
||||||
# do we want to show it?
|
# NOTE: lets ignore the show param and effectively use the semicolon at the end of the REPL statement
|
||||||
d = Dict(kw)
|
# # do we want to show it?
|
||||||
@show d
|
# d = Dict(kw)
|
||||||
if haskey(d, :show) && d[:show]
|
# @show d
|
||||||
display(subplt)
|
# if haskey(d, :show) && d[:show]
|
||||||
end
|
# println("here...why?")
|
||||||
|
# display(subplt)
|
||||||
|
# end
|
||||||
|
|
||||||
subplt
|
subplt
|
||||||
end
|
end
|
||||||
|
|||||||
@ -30,4 +30,5 @@ type Subplot <: PlottingObject
|
|||||||
n::Int # number of series
|
n::Int # number of series
|
||||||
layout::SubplotLayout
|
layout::SubplotLayout
|
||||||
initargs::Dict
|
initargs::Dict
|
||||||
|
initialized::Bool
|
||||||
end
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user