several fixes for type recipes; collect/zmin fixes in pgfplots; scatter3d recipe
This commit is contained in:
parent
fa84401866
commit
7248d8d7ce
@ -145,7 +145,6 @@ end
|
|||||||
|
|
||||||
# --------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
function pgf_series(sp::Subplot, series::Series)
|
function pgf_series(sp::Subplot, series::Series)
|
||||||
d = series.d
|
d = series.d
|
||||||
st = d[:seriestype]
|
st = d[:seriestype]
|
||||||
@ -173,6 +172,18 @@ function pgf_series(sp::Subplot, series::Series)
|
|||||||
d[:x], d[:y]
|
d[:x], d[:y]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# PGFPlots can't handle non-Vector?
|
||||||
|
args = map(a -> if typeof(a) <: AbstractVector && typeof(a) != Vector
|
||||||
|
collect(a)
|
||||||
|
else
|
||||||
|
a
|
||||||
|
end, args)
|
||||||
|
# for (i,a) in enumerate(args)
|
||||||
|
# if typeof(a) <: AbstractVector && typeof(a) != Vector
|
||||||
|
# args[i] = collect(a)
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
# include additional style, then add to the kw
|
# include additional style, then add to the kw
|
||||||
if haskey(_pgf_series_extrastyle, st)
|
if haskey(_pgf_series_extrastyle, st)
|
||||||
push!(style, _pgf_series_extrastyle[st])
|
push!(style, _pgf_series_extrastyle[st])
|
||||||
@ -216,9 +227,12 @@ function pgf_axis(sp::Subplot, letter)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# limits
|
# limits
|
||||||
lims = axis_limits(axis)
|
# TODO: support zlims
|
||||||
kw[Symbol(letter,:min)] = lims[1]
|
if letter != :z
|
||||||
kw[Symbol(letter,:max)] = lims[2]
|
lims = axis_limits(axis)
|
||||||
|
kw[Symbol(letter,:min)] = lims[1]
|
||||||
|
kw[Symbol(letter,:max)] = lims[2]
|
||||||
|
end
|
||||||
|
|
||||||
# return the style list and KW args
|
# return the style list and KW args
|
||||||
style, kw
|
style, kw
|
||||||
|
|||||||
@ -444,6 +444,20 @@ centers(v::AVec) = v[1] + cumsum(diff(v))
|
|||||||
()
|
()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# scatter 3d
|
||||||
|
|
||||||
|
@recipe function f(::Type{Val{:scatter3d}}, x, y, z)
|
||||||
|
seriestype := :path3d
|
||||||
|
if d[:markershape] == :none
|
||||||
|
markershape := :ellipse
|
||||||
|
end
|
||||||
|
linewidth := 0
|
||||||
|
linealpha := 0
|
||||||
|
()
|
||||||
|
end
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Box Plot
|
# Box Plot
|
||||||
|
|
||||||
|
|||||||
@ -117,7 +117,10 @@ immutable SliceIt end
|
|||||||
end
|
end
|
||||||
|
|
||||||
# this is the default "type recipe"... just pass the object through
|
# this is the default "type recipe"... just pass the object through
|
||||||
@recipe f{T}(::Type{T}, v::T) = v
|
@recipe f{T<:Any}(::Type{T}, v::T) = v
|
||||||
|
|
||||||
|
# this should catch unhandled "series recipes" and error with a nice message
|
||||||
|
@recipe f{V<:Val}(::Type{V}, x, y, z) = error("The backend must not support the series type $V, and there isn't a series recipe defined.")
|
||||||
|
|
||||||
_apply_type_recipe(d, v) = RecipesBase.apply_recipe(d, typeof(v), v)[1].args[1]
|
_apply_type_recipe(d, v) = RecipesBase.apply_recipe(d, typeof(v), v)[1].args[1]
|
||||||
|
|
||||||
@ -156,6 +159,24 @@ end
|
|||||||
SliceIt, nothing, y, nothing
|
SliceIt, nothing, y, nothing
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# if there's more than 3 inputs, it can't be passed directly to SliceIt
|
||||||
|
# so we'll apply_type_recipe to all of them
|
||||||
|
@recipe function f(v1, v2, v3, v4, vrest...)
|
||||||
|
did_replace = false
|
||||||
|
newargs = map(v -> begin
|
||||||
|
newv = _apply_type_recipe(d, v)
|
||||||
|
if newv !== v
|
||||||
|
did_replace = true
|
||||||
|
end
|
||||||
|
newv
|
||||||
|
end, (v1, v2, v3, v4, vrest...))
|
||||||
|
if !did_replace
|
||||||
|
error("Couldn't process recipe args: $(map(typeof, (v1, v2, v3, v4, vrest...)))")
|
||||||
|
end
|
||||||
|
newargs
|
||||||
|
end
|
||||||
|
|
||||||
# @recipe f(x, y, z) = SliceIt, apply_recipe(typeof(x), x), apply_recipe(typeof(y), y), apply_recipe(typeof(z), z)
|
# @recipe f(x, y, z) = SliceIt, apply_recipe(typeof(x), x), apply_recipe(typeof(y), y), apply_recipe(typeof(z), z)
|
||||||
# @recipe f(x, y) = SliceIt, apply_recipe(typeof(x), x), apply_recipe(typeof(y), y), nothing
|
# @recipe f(x, y) = SliceIt, apply_recipe(typeof(x), x), apply_recipe(typeof(y), y), nothing
|
||||||
# @recipe f(y) = SliceIt, nothing, apply_recipe(typeof(y), y), nothing
|
# @recipe f(y) = SliceIt, nothing, apply_recipe(typeof(y), y), nothing
|
||||||
@ -323,7 +344,7 @@ end
|
|||||||
@recipe function f(fx::FuncOrFuncs, fy::FuncOrFuncs, fz::FuncOrFuncs, u::AVec)
|
@recipe function f(fx::FuncOrFuncs, fy::FuncOrFuncs, fz::FuncOrFuncs, u::AVec)
|
||||||
mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u), mapFuncOrFuncs(fz, u)
|
mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u), mapFuncOrFuncs(fz, u)
|
||||||
end
|
end
|
||||||
@recipe function f(fx::FuncOrFuncs, fy::FuncOrFuncs, fz::FuncOrFuncs, umin::Number, umax::Number, numPointsn = 200)
|
@recipe function f(fx::FuncOrFuncs, fy::FuncOrFuncs, fz::FuncOrFuncs, umin::Number, umax::Number, numPoints = 200)
|
||||||
fx, fy, fz, linspace(umin, umax, numPoints)
|
fx, fy, fz, linspace(umin, umax, numPoints)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user