subplot palette fix, added copy methods for Plot and Subplot
This commit is contained in:
parent
607d5d7841
commit
34831d42a4
@ -138,6 +138,8 @@ _seriesDefaults[:nbins] = 30 # number of bins for heatma
|
|||||||
_seriesDefaults[:smooth] = false # regression line?
|
_seriesDefaults[:smooth] = false # regression line?
|
||||||
_seriesDefaults[:group] = nothing # groupby vector
|
_seriesDefaults[:group] = nothing # groupby vector
|
||||||
_seriesDefaults[:annotation] = nothing # annotation tuple(s)... (x,y,annotation)
|
_seriesDefaults[:annotation] = nothing # annotation tuple(s)... (x,y,annotation)
|
||||||
|
_seriesDefaults[:x] = nothing
|
||||||
|
_seriesDefaults[:y] = nothing
|
||||||
_seriesDefaults[:z] = nothing # depth for contour, surface, etc
|
_seriesDefaults[:z] = nothing # depth for contour, surface, etc
|
||||||
_seriesDefaults[:zcolor] = nothing # value for color scale
|
_seriesDefaults[:zcolor] = nothing # value for color scale
|
||||||
_seriesDefaults[:surface] = nothing
|
_seriesDefaults[:surface] = nothing
|
||||||
|
|||||||
@ -96,7 +96,6 @@ function Base.display(::PlotsDisplay, plt::Plot{PlotlyPackage})
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<script src="$(Pkg.dir("Plots"))/src/backends/plotly-latest.min.js"></script>
|
<script src="$(Pkg.dir("Plots"))/src/backends/plotly-latest.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
|
||||||
<div id="myplot" style="width:$(w)px;height:$(h)px;"></div>
|
<div id="myplot" style="width:$(w)px;height:$(h)px;"></div>
|
||||||
<script charset="utf-8">
|
<script charset="utf-8">
|
||||||
PLOT = document.getElementById('myplot');
|
PLOT = document.getElementById('myplot');
|
||||||
@ -113,7 +112,6 @@ function Base.display(::PlotsDisplay, plt::Plot{PlotlyPackage})
|
|||||||
write(output,
|
write(output,
|
||||||
"""
|
"""
|
||||||
</script>
|
</script>
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
""")
|
""")
|
||||||
close(output)
|
close(output)
|
||||||
|
|||||||
@ -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::PyPlotFigWrapper) = PyPlot.figure(wrap.fig.o[:number])
|
||||||
# makePyPlotCurrent(wrap::PyPlotAxisWrapper) = nothing #PyPlot.sca(wrap.ax.o)
|
# makePyPlotCurrent(wrap::PyPlotAxisWrapper) = nothing #PyPlot.sca(wrap.ax.o)
|
||||||
makePyPlotCurrent(wrap::PyPlotAxisWrapper) = wrap.ax == nothing ? PyPlot.figure(wrap.fig.o[:number]) : nothing
|
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})
|
function _before_add_series(plt::Plot{PyPlotPackage})
|
||||||
|
|||||||
@ -286,6 +286,10 @@ function get_color_palette(palette, bgcolor::@compat(Union{Colorant,ColorWrapper
|
|||||||
RGBA[getColorZ(grad, z) for z in zrng]
|
RGBA[getColorZ(grad, z) for z in zrng]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function get_color_palette(palette::Vector{RGBA}, bgcolor::@compat(Union{Colorant,ColorWrapper}), numcolors::Integer)
|
||||||
|
palette
|
||||||
|
end
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
11
src/plot.jl
11
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].
|
# create a new "createKWargsList" which converts all inputs into xs = Any[xitems], ys = Any[yitems].
|
||||||
# Special handling for: no args, xmin/xmax, parametric, dataframes
|
# Special handling for: no args, xmin/xmax, parametric, dataframes
|
||||||
|
|||||||
@ -266,7 +266,6 @@ end
|
|||||||
Set the plot backend. Choose from: :qwt, :gadfly, :unicodeplots, :immerse, :pyplot
|
Set the plot backend. Choose from: :qwt, :gadfly, :unicodeplots, :immerse, :pyplot
|
||||||
"""
|
"""
|
||||||
function backend(pkg::PlottingPackage)
|
function backend(pkg::PlottingPackage)
|
||||||
|
|
||||||
CURRENT_BACKEND.sym = backend_name(pkg)
|
CURRENT_BACKEND.sym = backend_name(pkg)
|
||||||
CURRENT_BACKEND.pkg = pkg
|
CURRENT_BACKEND.pkg = pkg
|
||||||
end
|
end
|
||||||
|
|||||||
@ -364,3 +364,8 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
|
function Base.copy(subplt::Subplot)
|
||||||
|
subplot(subplt.plts, subplt.layout, subplt.plotargs)
|
||||||
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user