reset_extrema; setxyz for z matrix
This commit is contained in:
parent
7ce783705a
commit
54923c082c
15
src/axes.jl
15
src/axes.jl
@ -224,6 +224,21 @@ end
|
|||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
function reset_extrema!(sp::Subplot)
|
||||||
|
# axis = sp[Symbol(asym,:axis)]
|
||||||
|
# axis[:extrema] = Extrema()
|
||||||
|
for asym in (:x,:y,:z)
|
||||||
|
sp[Symbol(asym,:axis)][:extrema] = Extrema()
|
||||||
|
end
|
||||||
|
for series in sp.series_list
|
||||||
|
@show series
|
||||||
|
# expand_extrema!(axis, series[asym])
|
||||||
|
expand_extrema!(sp, series.d)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function expand_extrema!(ex::Extrema, v::Number)
|
function expand_extrema!(ex::Extrema, v::Number)
|
||||||
ex.emin = min(v, ex.emin)
|
ex.emin = min(v, ex.emin)
|
||||||
ex.emax = max(v, ex.emax)
|
ex.emax = max(v, ex.emax)
|
||||||
|
|||||||
16
src/utils.jl
16
src/utils.jl
@ -660,26 +660,28 @@ function setxy!{X,Y}(plt::Plot, xy::Tuple{X,Y}, i::Integer)
|
|||||||
series = plt.series_list[i]
|
series = plt.series_list[i]
|
||||||
series.d[:x], series.d[:y] = xy
|
series.d[:x], series.d[:y] = xy
|
||||||
sp = series.d[:subplot]
|
sp = series.d[:subplot]
|
||||||
expand_extrema!(sp.attr[:xaxis], xy[1])
|
reset_extrema!(sp)
|
||||||
expand_extrema!(sp.attr[:yaxis], xy[2])
|
|
||||||
_series_updated(plt, series)
|
_series_updated(plt, series)
|
||||||
end
|
end
|
||||||
function setxyz!{X,Y,Z}(plt::Plot, xyz::Tuple{X,Y,Z}, i::Integer)
|
function setxyz!{X,Y,Z}(plt::Plot, xyz::Tuple{X,Y,Z}, i::Integer)
|
||||||
series = plt.series_list[i]
|
series = plt.series_list[i]
|
||||||
series.d[:x], series.d[:y], series.d[:z] = xyz
|
series.d[:x], series.d[:y], series.d[:z] = xyz
|
||||||
sp = series.d[:subplot]
|
sp = series.d[:subplot]
|
||||||
expand_extrema!(sp.attr[:xaxis], xyz[1])
|
reset_extrema!(sp)
|
||||||
expand_extrema!(sp.attr[:yaxis], xyz[2])
|
|
||||||
expand_extrema!(sp.attr[:zaxis], xyz[3])
|
|
||||||
_series_updated(plt, series)
|
_series_updated(plt, series)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function setxyz!{X,Y,Z<:AbstractMatrix}(plt::Plot, xyz::Tuple{X,Y,Z}, i::Integer)
|
||||||
|
setxyz!(plt, (xyz[1], xyz[2], Surface(xyz[3])), i)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
# indexing notation
|
# indexing notation
|
||||||
|
|
||||||
# Base.getindex(plt::Plot, i::Integer) = getxy(plt, i)
|
# Base.getindex(plt::Plot, i::Integer) = getxy(plt, i)
|
||||||
Base.setindex!{X,Y}(plt::Plot, xy::Tuple{X,Y}, i::Integer) = setxy!(plt, xy, i)
|
Base.setindex!{X,Y}(plt::Plot, xy::Tuple{X,Y}, i::Integer) = (setxy!(plt, xy, i); plt)
|
||||||
Base.setindex!{X,Y,Z}(plt::Plot, xyz::Tuple{X,Y,Z}, i::Integer) = setxyz!(plt, xyz, i)
|
Base.setindex!{X,Y,Z}(plt::Plot, xyz::Tuple{X,Y,Z}, i::Integer) = (setxyz!(plt, xyz, i); plt)
|
||||||
|
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user