From 2bde412fa3ada88237311ecc537c3f5e5e70cfd5 Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Wed, 7 Sep 2016 12:22:06 -0400 Subject: [PATCH] xlims/ylims/zlims convenience methods --- src/Plots.jl | 4 ++++ src/utils.jl | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/Plots.jl b/src/Plots.jl index f69a1361..9bb16339 100644 --- a/src/Plots.jl +++ b/src/Plots.jl @@ -63,6 +63,10 @@ export xaxis!, yaxis!, + xlims, + ylims, + zlims, + savefig, png, gui, diff --git a/src/utils.jl b/src/utils.jl index 390edb83..86001d78 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -475,6 +475,19 @@ function make_fillrange_from_ribbon(kw::KW) kw[:fillrange] = make_fillrange_side(y, rib1), make_fillrange_side(y, rib2) end +function get_sp_lims(sp::Subplot, letter::Symbol) + axis_limits(sp[Symbol(letter, :axis)]) +end +xlims(sp::Subplot) = get_sp_lims(sp, :x) +ylims(sp::Subplot) = get_sp_lims(sp, :y) +zlims(sp::Subplot) = get_sp_lims(sp, :z) +xlims(plt::Plot, sp_idx::Int = 1) = xlims(plt[sp_idx]) +ylims(plt::Plot, sp_idx::Int = 1) = ylims(plt[sp_idx]) +zlims(plt::Plot, sp_idx::Int = 1) = zlims(plt[sp_idx]) +xlims(sp_idx::Int = 1) = xlims(current(), sp_idx) +ylims(sp_idx::Int = 1) = ylims(current(), sp_idx) +zlims(sp_idx::Int = 1) = zlims(current(), sp_idx) + # --------------------------------------------------------------- wraptuple(x::Tuple) = x