winston lims

This commit is contained in:
Thomas Breloff 2015-09-29 10:40:46 -04:00
parent add724eee9
commit 2f55fb4d84
3 changed files with 52 additions and 39 deletions

File diff suppressed because one or more lines are too long

View File

@ -101,6 +101,8 @@ xlabel!(s::AbstractString) = plot!(xlabel = s)
ylabel!(s::AbstractString) = plot!(ylabel = s)
xlims!{T<:Real,S<:Real}(lims::Tuple{T,S}) = plot!(xlims = lims)
ylims!{T<:Real,S<:Real}(lims::Tuple{T,S}) = plot!(ylims = lims)
xlims!(xmin::Real, xmax::Real) = plot!(xlims = (xmin,xmax))
ylims!(ymin::Real, ymax::Real) = plot!(ylims = (ymin,ymax))
xticks!{T<:Real}(v::AVec{T}) = plot!(xticks = v)
yticks!{T<:Real}(v::AVec{T}) = plot!(yticks = v)
xticks!{T<:Real,S<:AbstractString}(ticks::AVec{T}, labels::AVec{S}) = plot!(xticks = (ticks,labels))
@ -112,6 +114,8 @@ xlabel!(plt::Plot, s::AbstractString) = plot!(plt; xlabel = s)
ylabel!(plt::Plot, s::AbstractString) = plot!(plt; ylabel = s)
xlims!{T<:Real,S<:Real}(plt::Plot, lims::Tuple{T,S}) = plot!(plt; xlims = lims)
ylims!{T<:Real,S<:Real}(plt::Plot, lims::Tuple{T,S}) = plot!(plt; ylims = lims)
xlims!(plt::Plot, xmin::Real, xmax::Real) = plot!(plt; xlims = (xmin,xmax))
ylims!(plt::Plot, ymin::Real, ymax::Real) = plot!(plt; ylims = (ymin,ymax))
xticks!{T<:Real}(plt::Plot, ticks::AVec{T}) = plot!(plt; xticks = ticks)
yticks!{T<:Real}(plt::Plot, ticks::AVec{T}) = plot!(plt; yticks = ticks)
xticks!{T<:Real,S<:AbstractString}(plt::Plot, ticks::AVec{T}, labels::AVec{S}) = plot!(plt; xticks = (ticks,labels))

View File

@ -64,11 +64,11 @@ supportedArgs(::WinstonPackage) = [
:windowtitle,
:x,
:xlabel,
# :xlims,
:xlims,
# :xticks,
:y,
:ylabel,
# :ylims,
:ylims,
# :yrightlabel,
# :yticks,
]
@ -216,18 +216,22 @@ function plot!(::WinstonPackage, plt::Plot; kw...)
end
# ----------------------------------------------------------------
const _winstonNames = Dict(:xlims => :xrange, :ylims => :yrange)
function updatePlotItems(plt::Plot{WinstonPackage}, d::Dict)
window, canvas, wplt = getWinstonItems(plt)
for k in (:xlabel, :ylabel, :title)
for k in (:xlabel, :ylabel, :title, :xlims, :ylims)
if haskey(d, k)
Winston.setattr(wplt, string(k), d[k])
Winston.setattr(wplt, string(get(_winstonNames, k, k)), d[k])
end
end
end
# -------------------------------
# ----------------------------------------------------------------
function createWinstonAnnotationObject(plt::Plot{WinstonPackage}, x, y, val::AbstractString)
Winston.text(x, y, val)
@ -240,7 +244,7 @@ function addAnnotations{X,Y,V}(plt::Plot{WinstonPackage}, anns::AVec{Tuple{X,Y,V
end
# -------------------------------
# ----------------------------------------------------------------
function buildSubplotObject!(subplt::Subplot{WinstonPackage})
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example