diff --git a/src/backends.jl b/src/backends.jl index ae0530b2..8d76e2c8 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -48,12 +48,13 @@ include("backends/web.jl") plot(pkg::AbstractBackend; kw...) = error("plot($pkg; kw...) is not implemented") plot!(pkg::AbstractBackend, plt::Plot; kw...) = error("plot!($pkg, plt; kw...) is not implemented") _update_plot(pkg::AbstractBackend, plt::Plot, d::KW) = error("_update_plot($pkg, plt, d) is not implemented") -_update_plot_pos_size{P<:AbstractBackend}(plt::AbstractPlot{P}, d::KW) = nothing subplot(pkg::AbstractBackend; kw...) = error("subplot($pkg; kw...) is not implemented") subplot!(pkg::AbstractBackend, subplt::Subplot; kw...) = error("subplot!($pkg, subplt; kw...) is not implemented") # don't do anything as a default _before_add_series(plt::Plot) = nothing +_add_annotations{X,Y,V}(plt::Plot, anns::AVec{Tuple{X,Y,V}}) = nothing +_update_plot_pos_size(plt::AbstractPlot, d::KW) = nothing # --------------------------------------------------------- diff --git a/src/components.jl b/src/components.jl index 623e3768..25efd2d3 100644 --- a/src/components.jl +++ b/src/components.jl @@ -639,7 +639,16 @@ 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) +function expand_extrema!(a::Axis, surf::Surface) + v = surf.surf + if !isempty(v) + emin, emax = a[:extrema] + a[:extrema] = (min(minimum(v), emin), max(maximum(v), emax)) + end + a[:extrema] +end "For the case of representing a surface as a function of x/y... can possibly avoid allocations." immutable SurfaceFunction <: AbstractSurface diff --git a/src/plot.jl b/src/plot.jl index 74e5f020..5628d4c3 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -200,6 +200,7 @@ function _plot!(plt::Plot, d::KW, args...) # if there was a grouping, filter the data here _filter_input_data!(kw) + @show typeof((kw[:x], kw[:y], kw[:z])) # map marker_z if it's a Function if isa(get(kw, :marker_z, nothing), Function) @@ -246,6 +247,10 @@ function _plot!(plt::Plot, d::KW, args...) # @show anns + for kw in kw_list + @show typeof((kw[:x], kw[:y], kw[:z])) + end + # merge plot args... this is where we combine all the plot args from the user and # from the recipes... axis info, colors, etc # TODO: why do i need to check for the subplot key? @@ -256,6 +261,9 @@ function _plot!(plt::Plot, d::KW, args...) handlePlotColors(plt.backend, plt.plotargs) end + for kw in kw_list + @show typeof((kw[:x], kw[:y], kw[:z])) + end # this is it folks! # TODO: we probably shouldn't use i for tracking series index, but rather explicitly track it in recipes diff --git a/src/series_new.jl b/src/series_new.jl index bf032cad..b5e2a5c5 100644 --- a/src/series_new.jl +++ b/src/series_new.jl @@ -92,7 +92,7 @@ immutable SliceIt end # the catch-all recipes @recipe function f(::Type{SliceIt}, x, y, z) - # @show "HERE", typeof((x,y,z)) + @show "HERE", typeof((x,y,z)) xs, _ = convertToAnyVector(x, d) ys, _ = convertToAnyVector(y, d) zs, _ = convertToAnyVector(z, d) @@ -105,7 +105,7 @@ immutable SliceIt end end mf = length(fillranges) - @show zs + # @show zs mx = length(xs) my = length(ys) @@ -115,9 +115,9 @@ immutable SliceIt end # add a new series di = copy(d) xi, yi, zi = xs[mod1(i,mx)], ys[mod1(i,my)], zs[mod1(i,mz)] - # @show i, typeof((xi, yi, zi)) + @show i, typeof((xi, yi, zi)) di[:x], di[:y], di[:z] = compute_xyz(xi, yi, zi) - # @show i, typeof((di[:x], di[:y], di[:z])) + @show i, typeof((di[:x], di[:y], di[:z])) # handle fillrange fr = fillranges[mod1(i,mf)] @@ -331,7 +331,7 @@ end # d[:x], d[:y] = x, y # end -@recipe function f{X,Y}(x::AVec{X}, y::AVec{Y}, zf::Function) +@recipe function f(x::AVec, y::AVec, zf::Function) # x = X <: Number ? sort(x) : x # y = Y <: Number ? sort(y) : y SliceIt, x, y, Surface(zf, x, y) # TODO: replace with SurfaceFunction when supported @@ -355,11 +355,11 @@ end # end # end -@recipe function f{X,Y,Z}(x::AVec{X}, y::AVec{Y}, z::AMat{Z}) +@recipe function f(x::AVec, y::AVec, z::AMat) if !like_surface(get(d, :seriestype, :none)) d[:seriestype] = :contour end - SliceIt, x, y, Surface{Matrix{Z}}(z) + SliceIt, x, y, Surface(z) end #