commit
0693cb7840
@ -72,6 +72,7 @@ export
|
||||
ylabel!,
|
||||
xlims!,
|
||||
ylims!,
|
||||
zlims!,
|
||||
xticks!,
|
||||
yticks!,
|
||||
annotate!,
|
||||
@ -194,8 +195,10 @@ xlabel!(s::AbstractString; kw...) = plot!(; xlabel = s, kw...)
|
||||
ylabel!(s::AbstractString; kw...) = plot!(; ylabel = s, kw...)
|
||||
xlims!{T<:Real,S<:Real}(lims::Tuple{T,S}; kw...) = plot!(; xlims = lims, kw...)
|
||||
ylims!{T<:Real,S<:Real}(lims::Tuple{T,S}; kw...) = plot!(; ylims = lims, kw...)
|
||||
zlims!{T<:Real,S<:Real}(lims::Tuple{T,S}; kw...) = plot!(; zlims = lims, kw...)
|
||||
xlims!(xmin::Real, xmax::Real; kw...) = plot!(; xlims = (xmin,xmax), kw...)
|
||||
ylims!(ymin::Real, ymax::Real; kw...) = plot!(; ylims = (ymin,ymax), kw...)
|
||||
zlims!(zmin::Real, zmax::Real; kw...) = plot!(; zlims = (zmin,zmax), kw...)
|
||||
xticks!{T<:Real}(v::AVec{T}; kw...) = plot!(; xticks = v, kw...)
|
||||
yticks!{T<:Real}(v::AVec{T}; kw...) = plot!(; yticks = v, kw...)
|
||||
xticks!{T<:Real,S<:AbstractString}(
|
||||
@ -214,8 +217,10 @@ xlabel!(plt::Plot, s::AbstractString; kw...) = plot!(plt; xlabel
|
||||
ylabel!(plt::Plot, s::AbstractString; kw...) = plot!(plt; ylabel = s, kw...)
|
||||
xlims!{T<:Real,S<:Real}(plt::Plot, lims::Tuple{T,S}; kw...) = plot!(plt; xlims = lims, kw...)
|
||||
ylims!{T<:Real,S<:Real}(plt::Plot, lims::Tuple{T,S}; kw...) = plot!(plt; ylims = lims, kw...)
|
||||
zlims!{T<:Real,S<:Real}(plt::Plot, lims::Tuple{T,S}; kw...) = plot!(plt; zlims = lims, kw...)
|
||||
xlims!(plt::Plot, xmin::Real, xmax::Real; kw...) = plot!(plt; xlims = (xmin,xmax), kw...)
|
||||
ylims!(plt::Plot, ymin::Real, ymax::Real; kw...) = plot!(plt; ylims = (ymin,ymax), kw...)
|
||||
zlims!(plt::Plot, zmin::Real, zmax::Real; kw...) = plot!(plt; zlims = (zmin,zmax), kw...)
|
||||
xticks!{T<:Real}(plt::Plot, ticks::AVec{T}; kw...) = plot!(plt; xticks = ticks, kw...)
|
||||
yticks!{T<:Real}(plt::Plot, ticks::AVec{T}; kw...) = plot!(plt; yticks = ticks, kw...)
|
||||
xticks!{T<:Real,S<:AbstractString}(plt::Plot,
|
||||
|
||||
@ -159,6 +159,7 @@ _plotDefaults[:background_color] = colorant"white"
|
||||
_plotDefaults[:foreground_color] = :auto
|
||||
_plotDefaults[:xlims] = :auto
|
||||
_plotDefaults[:ylims] = :auto
|
||||
_plotDefaults[:zlims] = :auto
|
||||
_plotDefaults[:xticks] = :auto
|
||||
_plotDefaults[:yticks] = :auto
|
||||
_plotDefaults[:xscale] = :identity
|
||||
@ -301,6 +302,9 @@ end
|
||||
:ylim => :ylims,
|
||||
:ylimit => :ylims,
|
||||
:ylimits => :ylims,
|
||||
:zlim => :zlims,
|
||||
:zlimit => :zlims,
|
||||
:zlimits => :zlims,
|
||||
:xtick => :xticks,
|
||||
:ytick => :yticks,
|
||||
:windowsize => :size,
|
||||
|
||||
@ -550,6 +550,9 @@ function set_lims!(plt::Plot{PyPlotBackend}, axis::Symbol)
|
||||
if plt.plotargs[:ylims] == :auto
|
||||
ax[:set_ylim](minmaxseries(plt.seriesargs, :y, axis)...)
|
||||
end
|
||||
if plt.plotargs[:zlims] == :auto
|
||||
ax[:set_zlim](minmaxseries(plt.seriesargs, :z, axis)...)
|
||||
end
|
||||
end
|
||||
|
||||
function Base.setindex!{X,Y}(plt::Plot{PyPlotBackend}, xy::Tuple{X,Y}, i::Integer)
|
||||
@ -574,19 +577,24 @@ end
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
function addPyPlotLims(ax, lims, isx::Bool)
|
||||
function addPyPlotLims(ax, lims, what)
|
||||
lims == :auto && return
|
||||
ltype = limsType(lims)
|
||||
if ltype == :limits
|
||||
if isx
|
||||
if what == :xlim
|
||||
isfinite(lims[1]) && ax[:set_xlim](left = lims[1])
|
||||
isfinite(lims[2]) && ax[:set_xlim](right = lims[2])
|
||||
else
|
||||
elseif what == :ylim
|
||||
isfinite(lims[1]) && ax[:set_ylim](bottom = lims[1])
|
||||
isfinite(lims[2]) && ax[:set_ylim](top = lims[2])
|
||||
elseif what == :zlim
|
||||
isfinite(lims[1]) && ax[:set_zlim](bottom = lims[1])
|
||||
isfinite(lims[2]) && ax[:set_zlim](top = lims[2])
|
||||
else
|
||||
error("Invalid argument at position 3: $what")
|
||||
end
|
||||
else
|
||||
error("Invalid input for $(isx ? "xlims" : "ylims"): ", lims)
|
||||
error("Invalid input for $what: ", lims)
|
||||
end
|
||||
end
|
||||
|
||||
@ -631,8 +639,9 @@ function _update_plot(plt::Plot{PyPlotBackend}, d::KW)
|
||||
haskey(d, :yscale) && applyPyPlotScale(ax, d[:yscale], false)
|
||||
|
||||
# limits and ticks
|
||||
haskey(d, :xlims) && addPyPlotLims(ax, d[:xlims], true)
|
||||
haskey(d, :ylims) && addPyPlotLims(ax, d[:ylims], false)
|
||||
haskey(d, :xlims) && addPyPlotLims(ax, d[:xlims], :xlim)
|
||||
haskey(d, :ylims) && addPyPlotLims(ax, d[:ylims], :ylim)
|
||||
haskey(d, :zlims) && addPyPlotLims(ax, d[:zlims], :zlim)
|
||||
haskey(d, :xticks) && addPyPlotTicks(ax, d[:xticks], true)
|
||||
haskey(d, :yticks) && addPyPlotTicks(ax, d[:yticks], false)
|
||||
|
||||
|
||||
@ -145,6 +145,7 @@ supportedArgs(::PyPlotBackend) = [
|
||||
:y,
|
||||
:ylabel,
|
||||
:ylims,
|
||||
:zlims,
|
||||
:yrightlabel,
|
||||
:yticks,
|
||||
:xscale,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user