diff --git a/src/args.jl b/src/args.jl index 3b109443..ac5bcb0f 100644 --- a/src/args.jl +++ b/src/args.jl @@ -138,6 +138,8 @@ _seriesDefaults[:nbins] = 30 # number of bins for heatma _seriesDefaults[:smooth] = false # regression line? _seriesDefaults[:group] = nothing # groupby vector _seriesDefaults[:annotation] = nothing # annotation tuple(s)... (x,y,annotation) +_seriesDefaults[:x] = nothing +_seriesDefaults[:y] = nothing _seriesDefaults[:z] = nothing # depth for contour, surface, etc _seriesDefaults[:zcolor] = nothing # value for color scale _seriesDefaults[:surface] = nothing diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl index 1e4070bb..21bc6cd8 100644 --- a/src/backends/plotly.jl +++ b/src/backends/plotly.jl @@ -96,7 +96,6 @@ function Base.display(::PlotsDisplay, plt::Plot{PlotlyPackage}) -
- """) close(output) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 66edeb54..65079ccd 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -169,7 +169,7 @@ handleSmooth(plt::Plot{PyPlotPackage}, ax, d::Dict, smooth::Real) = handleSmooth # makePyPlotCurrent(wrap::PyPlotFigWrapper) = PyPlot.figure(wrap.fig.o[:number]) # makePyPlotCurrent(wrap::PyPlotAxisWrapper) = nothing #PyPlot.sca(wrap.ax.o) makePyPlotCurrent(wrap::PyPlotAxisWrapper) = wrap.ax == nothing ? PyPlot.figure(wrap.fig.o[:number]) : nothing -makePyPlotCurrent(plt::Plot{PyPlotPackage}) = makePyPlotCurrent(plt.o) +makePyPlotCurrent(plt::Plot{PyPlotPackage}) = plt.o == nothing ? nothing : makePyPlotCurrent(plt.o) function _before_add_series(plt::Plot{PyPlotPackage}) diff --git a/src/colors.jl b/src/colors.jl index f92c85da..e39d4881 100644 --- a/src/colors.jl +++ b/src/colors.jl @@ -286,6 +286,10 @@ function get_color_palette(palette, bgcolor::@compat(Union{Colorant,ColorWrapper RGBA[getColorZ(grad, z) for z in zrng] end +function get_color_palette(palette::Vector{RGBA}, bgcolor::@compat(Union{Colorant,ColorWrapper}), numcolors::Integer) + palette +end + # ---------------------------------------------------------------------------------- diff --git a/src/plot.jl b/src/plot.jl index 2cea2c46..79e48860 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -194,6 +194,17 @@ end # -------------------------------------------------------------------- +function Base.copy(plt::Plot) + backend(plt.backend) + plt2 = plot(; plt.plotargs...) + for sargs in plt.seriesargs + sargs = filter((k,v) -> haskey(_seriesDefaults,k), sargs) + plot!(plt2; sargs...) + end + plt2 +end + +# -------------------------------------------------------------------- # create a new "createKWargsList" which converts all inputs into xs = Any[xitems], ys = Any[yitems]. # Special handling for: no args, xmin/xmax, parametric, dataframes diff --git a/src/plotter.jl b/src/plotter.jl index b4142500..da06da06 100644 --- a/src/plotter.jl +++ b/src/plotter.jl @@ -266,7 +266,6 @@ end Set the plot backend. Choose from: :qwt, :gadfly, :unicodeplots, :immerse, :pyplot """ function backend(pkg::PlottingPackage) - CURRENT_BACKEND.sym = backend_name(pkg) CURRENT_BACKEND.pkg = pkg end diff --git a/src/subplot.jl b/src/subplot.jl index 01fabcf2..b8931374 100644 --- a/src/subplot.jl +++ b/src/subplot.jl @@ -364,3 +364,8 @@ end +# -------------------------------------------------------------------- + +function Base.copy(subplt::Subplot) + subplot(subplt.plts, subplt.layout, subplt.plotargs) +end