diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index bdd5af27..5d605cc2 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -207,6 +207,10 @@ function _create_plot(pkg::PyPlotPackage; kw...) w,h = map(px2inch, d[:size]) bgcolor = getPyPlotColor(d[:background_color]) wrap = PyPlotAxisWrapper(nothing, nothing, PyPlot.figure(; figsize = (w,h), facecolor = bgcolor, dpi = DPI, tight_layout = true), []) + + if haskey(d, :linetype) && first(d[:linetype]) in _3dTypes # && isa(plt.o, PyPlotFigWrapper) + push!(wrap.kwargs, (:projection, "3d")) + end end plt = Plot(wrap, pkg, 0, d, Dict[]) @@ -218,9 +222,9 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...) d = Dict(kw) lt = d[:linetype] - if lt in _3dTypes # && isa(plt.o, PyPlotFigWrapper) - push!(plt.o.kwargs, (:projection, "3d")) - end + # if lt in _3dTypes # && isa(plt.o, PyPlotFigWrapper) + # push!(plt.o.kwargs, (:projection, "3d")) + # end ax = getAxis(plt, d[:axis]) if !(lt in supportedTypes(pkg)) @@ -249,7 +253,7 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...) end - lt = d[:linetype] + # lt = d[:linetype] extra_kwargs = Dict() plotfunc = getPyPlotFunction(plt, d[:axis], lt) @@ -349,15 +353,16 @@ function _add_series(pkg::PyPlotPackage, plt::Plot; kw...) handle = plotfunc(x, y, surf, extra_args...; extra_kwargs...) if d[:fillrange] != nothing extra_kwargs[:cmap] = getPyPlotColorMap(d[:fillcolor], d[:fillalpha]) + delete!(extra_kwargs, :linewidths) handle = ax[:contourf](x, y, surf, extra_args...; extra_kwargs...) end handle elseif lt in (:surface,:wireframe) - x, y, z = d[:x], d[:y], d[:z].surf + x, y, z = d[:x], d[:y], Array(d[:z]) if !ismatrix(x) || !ismatrix(y) x = repmat(x', length(y), 1) - y = repmat(y, 1, length(x)) + y = repmat(y, 1, length(d[:x])) z = z' end plotfunc(x, y, z; extra_kwargs...) diff --git a/src/components.jl b/src/components.jl index f1b7114b..5c4be5ba 100644 --- a/src/components.jl +++ b/src/components.jl @@ -231,6 +231,8 @@ end Surface(f::Function, x, y) = Surface(Float64[f(xi,yi) for xi in x, yi in y]) +Base.Array(surf::Surface) = surf.surf + # ----------------------------------------------------------------------- type OHLC{T<:Real} diff --git a/src/plot.jl b/src/plot.jl index db7a8c02..5eaca478 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -48,7 +48,7 @@ function plot(args...; kw...) preprocessArgs!(d) dumpdict(d, "After plot preprocessing") - plotargs = getPlotArgs(pkg, d, 1) + plotargs = merge(d, getPlotArgs(pkg, d, 1)) dumpdict(plotargs, "Plot args") plt = _create_plot(pkg; plotargs...) # create a new, blank plot diff --git a/src/utils.jl b/src/utils.jl index 56b14539..a6e65c78 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -174,7 +174,9 @@ function replaceAliases!(d::Dict, aliases::Dict) end createSegments(z) = collect(repmat(z',2,1))[2:end] + Base.first(c::Colorant) = c +Base.first(x::Symbol) = x sortedkeys(d::Dict) = sort(collect(keys(d))) @@ -201,6 +203,7 @@ isscalar(::Any) = false + # ticksType{T<:Real,S<:Real}(ticks::@compat(Tuple{T,S})) = :limits ticksType{T<:Real}(ticks::AVec{T}) = :ticks ticksType{T<:AVec,S<:AVec}(ticks::@compat(Tuple{T,S})) = :ticks_and_labels diff --git a/test/imgcomp.jl b/test/imgcomp.jl index e61e7523..b8c65878 100644 --- a/test/imgcomp.jl +++ b/test/imgcomp.jl @@ -73,7 +73,7 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = is # first Plots._debugMode.on = debug - example = ExamplePlots.examples[idx] + example = ExamplePlots._examples[idx] info("Testing plot: $pkg:$idx:$(example.header)") backend(pkg) backend() @@ -88,7 +88,7 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = is end # run the example - # map(eval, PlotExamples.examples[idx].exprs) + # map(eval, PlotExamples._examples[idx].exprs) # # save the png # tmpfn = tempname() * ".png" @@ -148,7 +148,7 @@ function image_comparison_tests(pkg::Symbol, idx::Int; debug = false, popup = is end function image_comparison_facts(pkg::Symbol; skip = [], debug = false, sigma = [1,1], eps = 1e-2) - for i in 1:length(ExamplePlots.examples) + for i in 1:length(ExamplePlots._examples) i in skip && continue @fact image_comparison_tests(pkg, i, debug=debug, sigma=sigma, eps=eps) |> success --> true end