From 6aa56fd30fa49d34bdf0935237227c74097eca7a Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Sat, 19 Sep 2015 00:38:50 -0400 Subject: [PATCH] fixed subplot bug --- src/backends/pyplot.jl | 4 ---- src/plot.jl | 20 ++++++++++---------- src/subplot.jl | 3 --- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index e2e899ca..951f69ae 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -185,16 +185,12 @@ function plot!(pkg::PyPlotPackage, plt::Plot; kw...) extraargs[:label] = d[:label] # do the plot - # @show lt if lt == :hist d[:serieshandle] = plotfunc(d[:y]; extraargs...)[1] elseif lt in (:scatter, :heatmap, :hexbin) d[:serieshandle] = plotfunc(d[:x], d[:y]; extraargs...) else d[:serieshandle] = plotfunc(d[:x], d[:y]; extraargs...)[1] - # retval = plotfunc(d[:x], d[:y]; extraargs...) - # @show retval - # d[:serieshandle] = retval end # this sets the bg color inside the grid (plt.o.o == matplotlib.Figure) diff --git a/src/plot.jl b/src/plot.jl index 0bc8311f..54964b5f 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -198,7 +198,7 @@ function createKWargsList{T<:Real}(plt::PlottingObject, y::AMat{T}; kw...) n,m = size(y) ret = [] for i in 1:m - d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+1), kw, i, plt.n + i) + d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+i), kw, i, plt.n + i) d[:x] = 1:n d[:y] = y[:,i] push!(ret, d) @@ -212,7 +212,7 @@ function createKWargsList{T<:Real,S<:Real}(plt::PlottingObject, x::AVec{T}, y::A @assert length(x) == n ret = [] for i in 1:m - d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+1), kw, i, plt.n + i) + d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+i), kw, i, plt.n + i) d[:x] = x d[:y] = y[:,i] push!(ret, d) @@ -226,7 +226,7 @@ function createKWargsList{T<:Real,S<:Real}(plt::PlottingObject, x::AMat{T}, y::A n,m = size(y) ret = [] for i in 1:m - d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+1), kw, i, plt.n + i) + d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+i), kw, i, plt.n + i) d[:x] = x[:,i] d[:y] = y[:,i] push!(ret, d) @@ -255,7 +255,7 @@ function createKWargsList(plt::PlottingObject, fs::Vector{Function}, xmin::Real, width = plt.initargs[:size][1] x = collect(linspace(xmin, xmax, width)) # we don't need more than the width for i in 1:m - d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+1), kw, i, plt.n + i) + d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+i), kw, i, plt.n + i) d[:x] = x d[:y] = map(fs[i], x) push!(ret, d) @@ -287,7 +287,7 @@ function createKWargsList{T<:Real}(plt::PlottingObject, x::AMat{T}, f::Function; n,m = size(x) ret = [] for i in 1:m - d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+1), kw, i, plt.n + i) + d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+i), kw, i, plt.n + i) d[:x] = x[:,i] d[:y] = map(f, d[:x]) push!(ret, d) @@ -307,7 +307,7 @@ function createKWargsList(plt::PlottingObject, y::AVec; kw...) m = length(y) ret = [] for i in 1:m - d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+1), kw, i, plt.n + i) + d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+i), kw, i, plt.n + i) d[:x] = 1:length(y[i]) d[:y] = y[i] push!(ret, d) @@ -327,7 +327,7 @@ function createKWargsList{T<:Real}(plt::PlottingObject, x::AVec{T}, y::AVec; kw. m = length(y) ret = [] for i in 1:m - d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+1), kw, i, plt.n + i) + d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+i), kw, i, plt.n + i) d[:x] = x d[:y] = getyvec(x, y[i]) push!(ret, d) @@ -341,7 +341,7 @@ function createKWargsList{T<:Real}(plt::PlottingObject, x::AVec, y::AMat{T}; kw. @assert length(x) == m ret = [] for i in 1:m - d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+1), kw, i, plt.n + i) + d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+i), kw, i, plt.n + i) d[:x] = x[i] d[:y] = getyvec(x[i], y[:,i]) push!(ret, d) @@ -355,7 +355,7 @@ function createKWargsList(plt::PlottingObject, x::AVec, y::AVec; kw...) m = length(y) ret = [] for i in 1:m - d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+1), kw, i, plt.n + i) + d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+i), kw, i, plt.n + i) d[:x] = x[i] d[:y] = getyvec(x[i], y[i]) push!(ret, d) @@ -367,7 +367,7 @@ end function createKWargsList(plt::PlottingObject, n::Integer; kw...) ret = [] for i in 1:n - d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+1), kw, i, plt.n + i) + d = getSeriesArgs(plt.plotter, getinitargs(plt, plt.n+i), kw, i, plt.n + i) d[:x] = zeros(0) d[:y] = zeros(0) push!(ret, d) diff --git a/src/subplot.jl b/src/subplot.jl index 3cfa708b..79794fee 100644 --- a/src/subplot.jl +++ b/src/subplot.jl @@ -117,18 +117,15 @@ function subplot!(subplt::Subplot, args...; kw...) d = Dict(kw) replaceAliases!(d) - @show d for k in keys(_plotDefaults) delete!(d, k) end - @show d kwList = createKWargsList(subplt, args...; d...) for (i,d) in enumerate(kwList) subplt.n += 1 plt = getplot(subplt) # get the Plot object where this series will be drawn d[:show] = false - @show d plot!(plt; d...) end