From c3f40d05559560fe8e9b07587a990e2eb30adae9 Mon Sep 17 00:00:00 2001 From: Tom Breloff Date: Mon, 28 Nov 2016 10:13:00 -0500 Subject: [PATCH] allow end in Plot/Subplot getindex; closes #587 --- src/types.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/types.jl b/src/types.jl index b9965eec..0f1e4909 100644 --- a/src/types.jl +++ b/src/types.jl @@ -90,10 +90,18 @@ end # ----------------------------------------------------------------------- Base.getindex(plt::Plot, i::Integer) = plt.subplots[i] +Base.length(plt::Plot) = length(plt.subplots) +Base.endof(plt::Plot) = length(plt) + Base.getindex(plt::Plot, r::Integer, c::Integer) = plt.layout[r,c] +Base.size(plt::Plot) = size(plt.layout) +Base.size(plt::Plot, i::Integer) = size(plt.layout)[i] +Base.ndims(plt::Plot) = 2 + # attr(plt::Plot, k::Symbol) = plt.attr[k] # attr!(plt::Plot, v, k::Symbol) = (plt.attr[k] = v) Base.getindex(sp::Subplot, i::Integer) = series_list(sp)[i] +Base.endof(sp::Subplot) = length(series_list(sp)) # -----------------------------------------------------------------------