surface fixes for mis-typed matrices; getindex for Series
This commit is contained in:
parent
7e56d85b83
commit
120f861a27
@ -930,6 +930,10 @@ function Base.getindex(axis::Axis, k::Symbol)
|
||||
end
|
||||
end
|
||||
|
||||
function Base.getindex(series::Series, k::Symbol)
|
||||
series.d[k]
|
||||
end
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# update attr from an input dictionary
|
||||
|
||||
10
src/axes.jl
10
src/axes.jl
@ -159,16 +159,18 @@ function expand_extrema!(sp::Subplot, d::KW)
|
||||
for letter in (:x, :y, :z)
|
||||
data = d[letter]
|
||||
axis = sp.attr[Symbol(letter, "axis")]
|
||||
if eltype(data) <: Number
|
||||
expand_extrema!(axis, data)
|
||||
elseif isa(data, Surface) && eltype(data.surf) <: Number
|
||||
if eltype(data) <: Number || (isa(data, Surface) && all(di -> isa(di, Number), data.surf))
|
||||
if !(eltype(data) <: Number)
|
||||
# huh... must have been a mis-typed surface? lets swap it out
|
||||
data = d[letter] = Surface(Matrix{Float64}(data.surf))
|
||||
end
|
||||
expand_extrema!(axis, data)
|
||||
elseif data != nothing
|
||||
# TODO: need more here... gotta track the discrete reference value
|
||||
# as well as any coord offset (think of boxplot shape coords... they all
|
||||
# correspond to the same x-value)
|
||||
# @show letter,eltype(data),typeof(data)
|
||||
d[letter], d[Symbol(letter,"_discrete_indices")] = discrete_value!(axis, data)
|
||||
expand_extrema!(axis, d[letter])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -399,8 +399,8 @@ Base.Array(surf::Surface) = surf.surf
|
||||
for f in (:length, :size)
|
||||
@eval Base.$f(surf::Surface, args...) = $f(surf.surf, args...)
|
||||
end
|
||||
Base.copy(surf::Surface) = Surface(copy(surf.surf))
|
||||
Base.eltype(surf::Surface) = eltype(surf.surf)
|
||||
Base.copy(surf::Surface) = Surface{typeof(surf.surf)}(copy(surf.surf))
|
||||
Base.eltype{T}(surf::Surface{T}) = eltype(T)
|
||||
|
||||
function expand_extrema!(a::Axis, surf::Surface)
|
||||
ex = a[:extrema]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user