subplot palette fix, added copy methods for Plot and Subplot

This commit is contained in:
Thomas Breloff 2015-11-20 12:55:45 -05:00
parent 607d5d7841
commit 34831d42a4
7 changed files with 23 additions and 4 deletions

View File

@ -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

View File

@ -96,7 +96,6 @@ function Base.display(::PlotsDisplay, plt::Plot{PlotlyPackage})
<meta charset="utf-8">
<script src="$(Pkg.dir("Plots"))/src/backends/plotly-latest.min.js"></script>
</head>
<body>
<div id="myplot" style="width:$(w)px;height:$(h)px;"></div>
<script charset="utf-8">
PLOT = document.getElementById('myplot');
@ -113,7 +112,6 @@ function Base.display(::PlotsDisplay, plt::Plot{PlotlyPackage})
write(output,
"""
</script>
</body>
</html>
""")
close(output)

View File

@ -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})

View File

@ -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
# ----------------------------------------------------------------------------------

View File

@ -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

View File

@ -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

View File

@ -364,3 +364,8 @@ end
# --------------------------------------------------------------------
function Base.copy(subplt::Subplot)
subplot(subplt.plts, subplt.layout, subplt.plotargs)
end