qwt subplots

This commit is contained in:
Thomas Breloff 2015-10-10 00:03:23 -04:00
parent 51e8f3ff6e
commit 48d802fc40
3 changed files with 97 additions and 24 deletions

File diff suppressed because one or more lines are too long

View File

@ -147,7 +147,7 @@ function updateLimsAndTicks(plt::Plot{QwtPackage}, d::Dict, isx::Bool)
w = plt.o.widget w = plt.o.widget
axisid = Qwt.QWT.QwtPlot[isx ? :xBottom : :yLeft] axisid = Qwt.QWT.QwtPlot[isx ? :xBottom : :yLeft]
if typeof(lims) <: Tuple if typeof(lims) <: @compat(Union{Tuple,AVec}) && length(lims) == 2
if isx if isx
plt.o.autoscale_x = false plt.o.autoscale_x = false
else else
@ -249,15 +249,35 @@ end
function buildSubplotObject!(subplt::Subplot{QwtPackage}) function buildSubplotObject!(subplt::Subplot{QwtPackage})
i = 0 i = 0
rows = [] rows = []
for rowcnt in subplt.layout.rowcounts row = []
push!(rows, Qwt.hsplitter([plt.o for plt in subplt.plts[(1:rowcnt) + i]]...)) for (i,(r,c)) in enumerate(subplt.layout)
i += rowcnt push!(row, subplt.plts[i].o)
if c == ncols(subplt.layout, r)
push!(rows, Qwt.hsplitter(row...))
row = []
end end
end
# for rowcnt in subplt.layout.rowcounts
# push!(rows, Qwt.hsplitter([plt.o for plt in subplt.plts[(1:rowcnt) + i]]...))
# i += rowcnt
# end
subplt.o = Qwt.vsplitter(rows...) subplt.o = Qwt.vsplitter(rows...)
Qwt.resizewidget(subplt.o, subplt.initargs[1][:size]...) Qwt.resizewidget(subplt.o, subplt.initargs[1][:size]...)
Qwt.moveToLastScreen(subplt.o) # hack so it goes to my center monitor... sorry Qwt.moveToLastScreen(subplt.o) # hack so it goes to my center monitor... sorry
end end
function handleLinkInner(plt::Plot{QwtPackage}, isx::Bool)
warn("handleLinkInner isn't implemented for qwt")
end
function expandLimits!(lims, plt::Plot{QwtPackage}, isx::Bool)
for series in plt.o.lines
expandLimits!(lims, isx ? series.x : series.y)
end
end
# ---------------------------------------------------------------- # ----------------------------------------------------------------
function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{QwtPackage}) function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{QwtPackage})

View File

@ -122,6 +122,7 @@ function linkAxis(subplt::Subplot, isx::Bool)
expandLimits!(lims, plt, isx) expandLimits!(lims, plt, isx)
end end
@show lims
for plt in subplt.plts for plt in subplt.plts
(isx ? xlims! : ylims!)(plt, lims...) (isx ? xlims! : ylims!)(plt, lims...)
end end