diff --git a/src/Plots.jl b/src/Plots.jl
index fd489073..16f407b7 100644
--- a/src/Plots.jl
+++ b/src/Plots.jl
@@ -10,123 +10,124 @@ using Requires
using FixedSizeArrays
export
- Plot,
- Subplot,
- SubplotLayout,
- GridLayout,
- RowsLayout,
- FlexLayout,
- AVec,
- AMat,
+ AbstractPlot,
+ Plot,
+ Subplot,
+ SubplotLayout,
+ GridLayout,
+ RowsLayout,
+ FlexLayout,
+ AVec,
+ AMat,
- plot,
- plot!,
- subplot,
- subplot!,
+ plot,
+ plot!,
+ subplot,
+ subplot!,
- current,
- default,
- with,
+ current,
+ default,
+ with,
- scatter,
- scatter!,
- bar,
- bar!,
- histogram,
- histogram!,
- histogram2d,
- histogram2d!,
- density,
- density!,
- heatmap,
- heatmap!,
- hexbin,
- hexbin!,
- sticks,
- sticks!,
- hline,
- hline!,
- vline,
- vline!,
- ohlc,
- ohlc!,
- pie,
- pie!,
- contour,
- contour!,
- surface,
- surface!,
- wireframe,
- wireframe!,
- path3d,
- path3d!,
- plot3d,
- plot3d!,
- scatter3d,
- scatter3d!,
- abline!,
+ scatter,
+ scatter!,
+ bar,
+ bar!,
+ histogram,
+ histogram!,
+ histogram2d,
+ histogram2d!,
+ density,
+ density!,
+ heatmap,
+ heatmap!,
+ hexbin,
+ hexbin!,
+ sticks,
+ sticks!,
+ hline,
+ hline!,
+ vline,
+ vline!,
+ ohlc,
+ ohlc!,
+ pie,
+ pie!,
+ contour,
+ contour!,
+ surface,
+ surface!,
+ wireframe,
+ wireframe!,
+ path3d,
+ path3d!,
+ plot3d,
+ plot3d!,
+ scatter3d,
+ scatter3d!,
+ abline!,
- title!,
- xlabel!,
- ylabel!,
- xlims!,
- ylims!,
- xticks!,
- yticks!,
- annotate!,
- xflip!,
- yflip!,
- xaxis!,
- yaxis!,
+ title!,
+ xlabel!,
+ ylabel!,
+ xlims!,
+ ylims!,
+ xticks!,
+ yticks!,
+ annotate!,
+ xflip!,
+ yflip!,
+ xaxis!,
+ yaxis!,
- savefig,
- png,
- gui,
+ savefig,
+ png,
+ gui,
- backend,
- backends,
- backend_name,
- aliases,
- dataframes,
+ backend,
+ backends,
+ backend_name,
+ aliases,
+ dataframes,
- Shape,
- text,
- font,
- stroke,
- brush,
- Surface,
- OHLC,
+ Shape,
+ text,
+ font,
+ stroke,
+ brush,
+ Surface,
+ OHLC,
- colorscheme,
- ColorScheme,
- ColorGradient,
- ColorVector,
- ColorWrapper,
- ColorFunction,
- ColorZFunction,
- getColor,
- getColorZ,
+ colorscheme,
+ ColorScheme,
+ ColorGradient,
+ ColorVector,
+ ColorWrapper,
+ ColorFunction,
+ ColorZFunction,
+ getColor,
+ getColorZ,
- debugplots,
+ debugplots,
- supportedArgs,
- supportedAxes,
- supportedTypes,
- supportedStyles,
- supportedMarkers,
- subplotSupported,
+ supportedArgs,
+ supportedAxes,
+ supportedTypes,
+ supportedStyles,
+ supportedMarkers,
+ subplotSupported,
- Animation,
- frame,
- gif,
- @animate,
- @gif,
+ Animation,
+ frame,
+ gif,
+ @animate,
+ @gif,
- # recipes
- PlotRecipe,
- # EllipseRecipe,
- spy
- # corrplot
+ # recipes
+ PlotRecipe,
+ # EllipseRecipe,
+ spy
+ # corrplot
# ---------------------------------------------------------
@@ -185,18 +186,18 @@ scatter3d(args...; kw...) = plot(args...; kw..., linetype = :scatter3d)
scatter3d!(args...; kw...) = plot!(args...; kw..., linetype = :scatter3d)
-title!(s::@compat(AbstractString); kw...) = plot!(; title = s, kw...)
-xlabel!(s::@compat(AbstractString); kw...) = plot!(; xlabel = s, kw...)
-ylabel!(s::@compat(AbstractString); kw...) = plot!(; ylabel = s, kw...)
-xlims!{T<:Real,S<:Real}(lims::@compat(Tuple{T,S}); kw...) = plot!(; xlims = lims, kw...)
-ylims!{T<:Real,S<:Real}(lims::@compat(Tuple{T,S}); kw...) = plot!(; ylims = lims, kw...)
+title!(s::AbstractString; kw...) = plot!(; title = s, kw...)
+xlabel!(s::AbstractString; kw...) = plot!(; xlabel = s, kw...)
+ylabel!(s::AbstractString; kw...) = plot!(; ylabel = s, kw...)
+xlims!{T<:Real,S<:Real}(lims::Tuple{T,S}; kw...) = plot!(; xlims = lims, kw...)
+ylims!{T<:Real,S<:Real}(lims::Tuple{T,S}; kw...) = plot!(; ylims = lims, kw...)
xlims!(xmin::Real, xmax::Real; kw...) = plot!(; xlims = (xmin,xmax), kw...)
ylims!(ymin::Real, ymax::Real; kw...) = plot!(; ylims = (ymin,ymax), kw...)
xticks!{T<:Real}(v::AVec{T}; kw...) = plot!(; xticks = v, kw...)
yticks!{T<:Real}(v::AVec{T}; kw...) = plot!(; yticks = v, kw...)
-xticks!{T<:Real,S<:@compat(AbstractString)}(
+xticks!{T<:Real,S<:AbstractString}(
ticks::AVec{T}, labels::AVec{S}; kw...) = plot!(; xticks = (ticks,labels), kw...)
-yticks!{T<:Real,S<:@compat(AbstractString)}(
+yticks!{T<:Real,S<:AbstractString}(
ticks::AVec{T}, labels::AVec{S}; kw...) = plot!(; yticks = (ticks,labels), kw...)
annotate!(anns...; kw...) = plot!(; annotation = anns, kw...)
annotate!{T<:Tuple}(anns::AVec{T}; kw...) = plot!(; annotation = anns, kw...)
@@ -205,18 +206,18 @@ yflip!(flip::Bool = true; kw...) = plot!(; yflip = flip
xaxis!(args...; kw...) = plot!(; xaxis = args, kw...)
yaxis!(args...; kw...) = plot!(; yaxis = args, kw...)
-title!(plt::Plot, s::@compat(AbstractString); kw...) = plot!(plt; title = s, kw...)
-xlabel!(plt::Plot, s::@compat(AbstractString); kw...) = plot!(plt; xlabel = s, kw...)
-ylabel!(plt::Plot, s::@compat(AbstractString); kw...) = plot!(plt; ylabel = s, kw...)
-xlims!{T<:Real,S<:Real}(plt::Plot, lims::@compat(Tuple{T,S}); kw...) = plot!(plt; xlims = lims, kw...)
-ylims!{T<:Real,S<:Real}(plt::Plot, lims::@compat(Tuple{T,S}); kw...) = plot!(plt; ylims = lims, kw...)
+title!(plt::Plot, s::AbstractString; kw...) = plot!(plt; title = s, kw...)
+xlabel!(plt::Plot, s::AbstractString; kw...) = plot!(plt; xlabel = s, kw...)
+ylabel!(plt::Plot, s::AbstractString; kw...) = plot!(plt; ylabel = s, kw...)
+xlims!{T<:Real,S<:Real}(plt::Plot, lims::Tuple{T,S}; kw...) = plot!(plt; xlims = lims, kw...)
+ylims!{T<:Real,S<:Real}(plt::Plot, lims::Tuple{T,S}; kw...) = plot!(plt; ylims = lims, kw...)
xlims!(plt::Plot, xmin::Real, xmax::Real; kw...) = plot!(plt; xlims = (xmin,xmax), kw...)
ylims!(plt::Plot, ymin::Real, ymax::Real; kw...) = plot!(plt; ylims = (ymin,ymax), kw...)
xticks!{T<:Real}(plt::Plot, ticks::AVec{T}; kw...) = plot!(plt; xticks = ticks, kw...)
yticks!{T<:Real}(plt::Plot, ticks::AVec{T}; kw...) = plot!(plt; yticks = ticks, kw...)
-xticks!{T<:Real,S<:@compat(AbstractString)}(plt::Plot,
+xticks!{T<:Real,S<:AbstractString}(plt::Plot,
ticks::AVec{T}, labels::AVec{S}; kw...) = plot!(plt; xticks = (ticks,labels), kw...)
-yticks!{T<:Real,S<:@compat(AbstractString)}(plt::Plot,
+yticks!{T<:Real,S<:AbstractString}(plt::Plot,
ticks::AVec{T}, labels::AVec{S}; kw...) = plot!(plt; yticks = (ticks,labels), kw...)
annotate!(plt::Plot, anns...; kw...) = plot!(plt; annotation = anns, kw...)
annotate!{T<:Tuple}(plt::Plot, anns::AVec{T}; kw...) = plot!(plt; annotation = anns, kw...)
@@ -236,7 +237,7 @@ function __init__()
# override IJulia inline display
if isijulia()
@eval import IJulia
- IJulia.display_dict(plt::PlottingObject) = Dict{ASCIIString, ByteString}("text/html" => sprint(writemime, "text/html", plt))
+ IJulia.display_dict(plt::AbstractPlot) = Dict{ASCIIString, ByteString}("text/html" => sprint(writemime, "text/html", plt))
end
end
diff --git a/src/animation.jl b/src/animation.jl
index a11e48db..843801b1 100644
--- a/src/animation.jl
+++ b/src/animation.jl
@@ -9,7 +9,7 @@ function Animation()
Animation(tmpdir, ASCIIString[])
end
-function frame{P<:PlottingObject}(anim::Animation, plt::P=current())
+function frame{P<:AbstractPlot}(anim::Animation, plt::P=current())
i = length(anim.frames) + 1
filename = @sprintf("%06d.png", i)
png(plt, joinpath(anim.dir, filename))
diff --git a/src/args.jl b/src/args.jl
index 41139354..990d0b61 100644
--- a/src/args.jl
+++ b/src/args.jl
@@ -185,7 +185,7 @@ _plotDefaults[:overwrite_figure] = false
# TODO: x/y scales
const _allArgs = sort(collect(union(keys(_seriesDefaults), keys(_plotDefaults))))
-supportedArgs(::PlottingPackage) = error("supportedArgs not defined") #_allArgs
+supportedArgs(::AbstractBackend) = error("supportedArgs not defined") #_allArgs
supportedArgs() = supportedArgs(backend())
@@ -632,7 +632,7 @@ end
# -----------------------------------------------------------------------------
-function warnOnUnsupportedArgs(pkg::PlottingPackage, d::Dict)
+function warnOnUnsupportedArgs(pkg::AbstractBackend, d::Dict)
for k in sortedkeys(d)
if (!(k in supportedArgs(pkg))
&& k != :subplot
@@ -642,11 +642,11 @@ function warnOnUnsupportedArgs(pkg::PlottingPackage, d::Dict)
end
end
-_markershape_supported(pkg::PlottingPackage, shape::Symbol) = shape in supportedMarkers(pkg)
-_markershape_supported(pkg::PlottingPackage, shape::Shape) = Shape in supportedMarkers(pkg)
-_markershape_supported(pkg::PlottingPackage, shapes::AVec) = all([_markershape_supported(pkg, shape) for shape in shapes])
+_markershape_supported(pkg::AbstractBackend, shape::Symbol) = shape in supportedMarkers(pkg)
+_markershape_supported(pkg::AbstractBackend, shape::Shape) = Shape in supportedMarkers(pkg)
+_markershape_supported(pkg::AbstractBackend, shapes::AVec) = all([_markershape_supported(pkg, shape) for shape in shapes])
-function warnOnUnsupported(pkg::PlottingPackage, d::Dict)
+function warnOnUnsupported(pkg::AbstractBackend, d::Dict)
(d[:axis] in supportedAxes(pkg)
|| warn("axis $(d[:axis]) is unsupported with $pkg. Choose from: $(supportedAxes(pkg))"))
(d[:linetype] == :none
@@ -661,7 +661,7 @@ function warnOnUnsupported(pkg::PlottingPackage, d::Dict)
|| warn("markershape $(d[:markershape]) is unsupported with $pkg. Choose from: $(supportedMarkers(pkg))"))
end
-function warnOnUnsupportedScales(pkg::PlottingPackage, d::Dict)
+function warnOnUnsupportedScales(pkg::AbstractBackend, d::Dict)
for k in (:xscale, :yscale)
if haskey(d, k)
d[k] in supportedScales(pkg) || warn("scale $(d[k]) is unsupported with $pkg. Choose from: $(supportedScales(pkg))")
@@ -709,7 +709,7 @@ convertLegendValue(val::Bool) = val ? :best : :none
# -----------------------------------------------------------------------------
# build the argument dictionary for the plot
-function getPlotArgs(pkg::PlottingPackage, kw, idx::Int; set_defaults = true)
+function getPlotArgs(pkg::AbstractBackend, kw, idx::Int; set_defaults = true)
kwdict = Dict(kw)
d = Dict()
@@ -746,7 +746,7 @@ end
# build the argument dictionary for a series
-function getSeriesArgs(pkg::PlottingPackage, plotargs::Dict, kw, commandIndex::Int, plotIndex::Int, globalIndex::Int) # TODO, pass in plotargs, not plt
+function getSeriesArgs(pkg::AbstractBackend, plotargs::Dict, kw, commandIndex::Int, plotIndex::Int, globalIndex::Int) # TODO, pass in plotargs, not plt
kwdict = Dict(kw)
d = Dict()
diff --git a/src/backends.jl b/src/backends.jl
index ac142ba6..11185e87 100644
--- a/src/backends.jl
+++ b/src/backends.jl
@@ -1,8 +1,8 @@
-immutable NoPackage <: PlottingPackage end
+immutable NoBackend <: AbstractBackend end
-const _backendType = Dict{Symbol, DataType}(:none => NoPackage)
-const _backendSymbol = Dict{DataType, Symbol}(NoPackage => :none)
+const _backendType = Dict{Symbol, DataType}(:none => NoBackend)
+const _backendSymbol = Dict{DataType, Symbol}(NoBackend => :none)
const _backends = Symbol[]
const _initialized_backends = Set{Symbol}()
@@ -10,12 +10,12 @@ backends() = _backends
backend_name() = CURRENT_BACKEND.sym
_backend_instance(sym::Symbol) = haskey(_backendType, sym) ? _backendType[sym]() : error("Unsupported backend $sym")
-macro init_plotting_pkg(s)
+macro init_backend(s)
str = lowercase(string(s))
sym = symbol(str)
- T = symbol(string(s) * "Package")
+ T = symbol(string(s) * "Backend")
esc(quote
- immutable $T <: PlottingPackage end
+ immutable $T <: AbstractBackend end
export $sym
$sym(; kw...) = (default(; kw...); backend(symbol($str)))
backend_name(::$T) = symbol($str)
@@ -26,18 +26,18 @@ macro init_plotting_pkg(s)
end)
end
-@init_plotting_pkg Immerse
-@init_plotting_pkg Gadfly
-@init_plotting_pkg PyPlot
-@init_plotting_pkg Qwt
-@init_plotting_pkg UnicodePlots
-@init_plotting_pkg Winston
-@init_plotting_pkg Bokeh
-@init_plotting_pkg Plotly
-@init_plotting_pkg PlotlyJS
-@init_plotting_pkg GR
-@init_plotting_pkg GLVisualize
-@init_plotting_pkg PGFPlots
+@init_backend Immerse
+@init_backend Gadfly
+@init_backend PyPlot
+@init_backend Qwt
+@init_backend UnicodePlots
+@init_backend Winston
+@init_backend Bokeh
+@init_backend Plotly
+@init_backend PlotlyJS
+@init_backend GR
+@init_backend GLVisualize
+@init_backend PGFPlots
include("backends/web.jl")
include("backends/supported.jl")
@@ -45,19 +45,19 @@ include("backends/supported.jl")
# ---------------------------------------------------------
-plot(pkg::PlottingPackage; kw...) = error("plot($pkg; kw...) is not implemented")
-plot!(pkg::PlottingPackage, plt::Plot; kw...) = error("plot!($pkg, plt; kw...) is not implemented")
-_update_plot(pkg::PlottingPackage, plt::Plot, d::Dict) = error("_update_plot($pkg, plt, d) is not implemented")
-_update_plot_pos_size{P<:PlottingPackage}(plt::PlottingObject{P}, d::Dict) = nothing
-subplot(pkg::PlottingPackage; kw...) = error("subplot($pkg; kw...) is not implemented")
-subplot!(pkg::PlottingPackage, subplt::Subplot; kw...) = error("subplot!($pkg, subplt; kw...) is not implemented")
+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::Dict) = error("_update_plot($pkg, plt, d) is not implemented")
+_update_plot_pos_size{P<:AbstractBackend}(plt::AbstractPlot{P}, d::Dict) = 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")
# ---------------------------------------------------------
type CurrentBackend
sym::Symbol
- pkg::PlottingPackage
+ pkg::AbstractBackend
end
CurrentBackend(sym::Symbol) = CurrentBackend(sym, _backend_instance(sym))
@@ -92,7 +92,7 @@ function backend()
# initialize
println("[Plots.jl] Initializing backend: ", sym)
-
+
inst = _backend_instance(sym)
try
_initialize_backend(inst)
@@ -110,7 +110,7 @@ end
"""
Set the plot backend.
"""
-function backend(pkg::PlottingPackage)
+function backend(pkg::AbstractBackend)
CURRENT_BACKEND.sym = backend_name(pkg)
CURRENT_BACKEND.pkg = pkg
end
diff --git a/src/backends/bokeh.jl b/src/backends/bokeh.jl
index 09fa303d..a6e74fb0 100644
--- a/src/backends/bokeh.jl
+++ b/src/backends/bokeh.jl
@@ -2,7 +2,7 @@
# https://github.com/bokeh/Bokeh.jl
-function _initialize_backend(::BokehPackage; kw...)
+function _initialize_backend(::BokehBackend; kw...)
@eval begin
warn("Bokeh is no longer supported... many features will likely be broken.")
import Bokeh
@@ -64,7 +64,7 @@ end
# ---------------------------------------------------------------------------
-function _create_plot(pkg::BokehPackage; kw...)
+function _create_plot(pkg::BokehBackend; kw...)
d = Dict(kw)
# dumpdict(d, "plot", true)
@@ -88,7 +88,7 @@ function _create_plot(pkg::BokehPackage; kw...)
end
-function _add_series(::BokehPackage, plt::Plot; kw...)
+function _add_series(::BokehBackend, plt::Plot; kw...)
d = Dict(kw)
# dumpdict(d, "plot!", true)
@@ -114,22 +114,22 @@ end
# ----------------------------------------------------------------
# TODO: override this to update plot items (title, xlabel, etc) after creation
-function _update_plot(plt::Plot{BokehPackage}, d::Dict)
+function _update_plot(plt::Plot{BokehBackend}, d::Dict)
end
-function _update_plot_pos_size(plt::PlottingObject{BokehPackage}, d::Dict)
+function _update_plot_pos_size(plt::AbstractPlot{BokehBackend}, d::Dict)
end
# ----------------------------------------------------------------
# accessors for x/y data
-function Base.getindex(plt::Plot{BokehPackage}, i::Int)
+function Base.getindex(plt::Plot{BokehBackend}, i::Int)
series = plt.o.datacolumns[i].data
series[:x], series[:y]
end
-function Base.setindex!(plt::Plot{BokehPackage}, xy::Tuple, i::Integer)
+function Base.setindex!(plt::Plot{BokehBackend}, xy::Tuple, i::Integer)
series = plt.o.datacolumns[i].data
series[:x], series[:y] = xy
plt
@@ -138,7 +138,7 @@ end
# ----------------------------------------------------------------
-function _add_annotations{X,Y,V}(plt::Plot{BokehPackage}, anns::AVec{@compat(Tuple{X,Y,V})})
+function _add_annotations{X,Y,V}(plt::Plot{BokehBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
for ann in anns
# TODO: add the annotation to the plot
end
@@ -146,31 +146,31 @@ end
# ----------------------------------------------------------------
-function _create_subplot(subplt::Subplot{BokehPackage}, isbefore::Bool)
+function _create_subplot(subplt::Subplot{BokehBackend}, isbefore::Bool)
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example
end
-function _expand_limits(lims, plt::Plot{BokehPackage}, isx::Bool)
+function _expand_limits(lims, plt::Plot{BokehBackend}, isx::Bool)
# TODO: call expand limits for each plot data
end
-function _remove_axis(plt::Plot{BokehPackage}, isx::Bool)
+function _remove_axis(plt::Plot{BokehBackend}, isx::Bool)
# TODO: if plot is inner subplot, might need to remove ticks or axis labels
end
# ----------------------------------------------------------------
-function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{BokehPackage})
+function Base.writemime(io::IO, ::MIME"image/png", plt::AbstractPlot{BokehBackend})
# TODO: write a png to io
warn("mime png not implemented")
end
-function Base.display(::PlotsDisplay, plt::Plot{BokehPackage})
+function Base.display(::PlotsDisplay, plt::Plot{BokehBackend})
Bokeh.showplot(plt.o)
end
-function Base.display(::PlotsDisplay, plt::Subplot{BokehPackage})
+function Base.display(::PlotsDisplay, plt::Subplot{BokehBackend})
# TODO: display/show the subplot
end
diff --git a/src/backends/gadfly.jl b/src/backends/gadfly.jl
index 963af95d..3beb01e9 100644
--- a/src/backends/gadfly.jl
+++ b/src/backends/gadfly.jl
@@ -2,7 +2,7 @@
# https://github.com/dcjones/Gadfly.jl
-function _initialize_backend(::GadflyPackage; kw...)
+function _initialize_backend(::GadflyBackend; kw...)
@eval begin
import Gadfly, Compose
export Gadfly, Compose
@@ -205,7 +205,7 @@ function getGadflyMarkerTheme(d::Dict, plotargs::Dict)
)
end
-function addGadflyContColorScale(plt::Plot{GadflyPackage}, c)
+function addGadflyContColorScale(plt::Plot{GadflyBackend}, c)
plt.plotargs[:colorbar] == :none && return
if !isa(c, ColorGradient)
c = colorscheme(:bluesreds)
@@ -557,7 +557,7 @@ function createGadflyAnnotationObject(x, y, txt::PlotText)
))
end
-function _add_annotations{X,Y,V}(plt::Plot{GadflyPackage}, anns::AVec{@compat(Tuple{X,Y,V})})
+function _add_annotations{X,Y,V}(plt::Plot{GadflyBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
for ann in anns
push!(plt.o.guides, createGadflyAnnotationObject(ann...))
end
@@ -567,7 +567,7 @@ end
# ---------------------------------------------------------------------------
# create a blank Gadfly.Plot object
-function _create_plot(pkg::GadflyPackage; kw...)
+function _create_plot(pkg::GadflyBackend; kw...)
d = Dict(kw)
gplt = createGadflyPlotObject(d)
Plot(gplt, pkg, 0, d, Dict[])
@@ -575,7 +575,7 @@ end
# plot one data series
-function _add_series(::GadflyPackage, plt::Plot; kw...)
+function _add_series(::GadflyBackend, plt::Plot; kw...)
# first clear out the temporary layer
gplt = getGadflyContext(plt)
@@ -591,7 +591,7 @@ end
-function _update_plot(plt::Plot{GadflyPackage}, d::Dict)
+function _update_plot(plt::Plot{GadflyBackend}, d::Dict)
updateGadflyGuides(plt, d)
updateGadflyPlotTheme(plt, d)
end
@@ -607,12 +607,12 @@ function getGadflyMappings(plt::Plot, i::Integer)
mappings = [l.mapping for l in plt.seriesargs[i][:gadflylayers]]
end
-function Base.getindex(plt::Plot{GadflyPackage}, i::Integer)
+function Base.getindex(plt::Plot{GadflyBackend}, i::Integer)
mapping = getGadflyMappings(plt, i)[1]
mapping[:x], mapping[:y]
end
-function Base.setindex!(plt::Plot{GadflyPackage}, xy::Tuple, i::Integer)
+function Base.setindex!(plt::Plot{GadflyBackend}, xy::Tuple, i::Integer)
for mapping in getGadflyMappings(plt, i)
mapping[:x], mapping[:y] = xy
end
@@ -623,20 +623,20 @@ end
# create the underlying object (each backend will do this differently)
-function _create_subplot(subplt::Subplot{GadflyPackage}, isbefore::Bool)
+function _create_subplot(subplt::Subplot{GadflyBackend}, isbefore::Bool)
isbefore && return false # wait until after plotting to create the subplots
subplt.o = nothing
true
end
-function _remove_axis(plt::Plot{GadflyPackage}, isx::Bool)
+function _remove_axis(plt::Plot{GadflyBackend}, isx::Bool)
gplt = getGadflyContext(plt)
addOrReplace(gplt.guides, isx ? Gadfly.Guide.xticks : Gadfly.Guide.yticks; label=false)
addOrReplace(gplt.guides, isx ? Gadfly.Guide.xlabel : Gadfly.Guide.ylabel, "")
end
-function _expand_limits(lims, plt::Plot{GadflyPackage}, isx::Bool)
+function _expand_limits(lims, plt::Plot{GadflyBackend}, isx::Bool)
for l in getGadflyContext(plt).layers
_expand_limits(lims, l.mapping[isx ? :x : :y])
end
@@ -646,8 +646,8 @@ end
# ----------------------------------------------------------------
-getGadflyContext(plt::Plot{GadflyPackage}) = plt.o
-getGadflyContext(subplt::Subplot{GadflyPackage}) = buildGadflySubplotContext(subplt)
+getGadflyContext(plt::Plot{GadflyBackend}) = plt.o
+getGadflyContext(subplt::Subplot{GadflyBackend}) = buildGadflySubplotContext(subplt)
# create my Compose.Context grid by hstacking and vstacking the Gadfly.Plot objects
function buildGadflySubplotContext(subplt::Subplot)
@@ -675,7 +675,7 @@ setGadflyDisplaySize(subplt::Subplot) = setGadflyDisplaySize(getplotargs(subplt,
# -------------------------------------------------------------------------
-function dowritemime{P<:Union{GadflyPackage,ImmersePackage}}(io::IO, func, plt::PlottingObject{P})
+function dowritemime{P<:Union{GadflyBackend,ImmerseBackend}}(io::IO, func, plt::AbstractPlot{P})
gplt = getGadflyContext(plt)
setGadflyDisplaySize(plt)
Gadfly.draw(func(io, Compose.default_graphic_width, Compose.default_graphic_height), gplt)
@@ -690,7 +690,7 @@ getGadflyWriteFunc(::MIME"application/x-tex") = Gadfly.PGF
getGadflyWriteFunc(m::MIME) = error("Unsupported in Gadfly/Immerse: ", m)
for mime in (MIME"image/png", MIME"image/svg+xml", MIME"application/pdf", MIME"application/postscript", MIME"application/x-tex")
- @eval function Base.writemime{P<:Union{GadflyPackage,ImmersePackage}}(io::IO, ::$mime, plt::PlottingObject{P})
+ @eval function Base.writemime{P<:Union{GadflyBackend,ImmerseBackend}}(io::IO, ::$mime, plt::AbstractPlot{P})
func = getGadflyWriteFunc($mime())
dowritemime(io, func, plt)
end
@@ -698,14 +698,14 @@ end
-function Base.display(::PlotsDisplay, plt::Plot{GadflyPackage})
+function Base.display(::PlotsDisplay, plt::Plot{GadflyBackend})
setGadflyDisplaySize(plt.plotargs[:size]...)
display(plt.o)
end
-function Base.display(::PlotsDisplay, subplt::Subplot{GadflyPackage})
+function Base.display(::PlotsDisplay, subplt::Subplot{GadflyBackend})
setGadflyDisplaySize(getplotargs(subplt,1)[:size]...)
ctx = buildGadflySubplotContext(subplt)
diff --git a/src/backends/glvisualize.jl b/src/backends/glvisualize.jl
index 82d60fcf..61639575 100644
--- a/src/backends/glvisualize.jl
+++ b/src/backends/glvisualize.jl
@@ -2,7 +2,7 @@
# [WEBSITE]
-function _initialize_backend(::GLVisualizePackage; kw...)
+function _initialize_backend(::GLVisualizeBackend; kw...)
@eval begin
import GLVisualize
export GLVisualize
@@ -15,7 +15,7 @@ immutable GLScreenWrapper
window
end
-function _create_plot(pkg::GLVisualizePackage; kw...)
+function _create_plot(pkg::GLVisualizeBackend; kw...)
d = Dict(kw)
# TODO: create the window/canvas/context that is the plot within the backend (call it `o`)
# TODO: initialize the plot... title, xlabel, bgcolor, etc
@@ -27,7 +27,7 @@ function _create_plot(pkg::GLVisualizePackage; kw...)
end
-function _add_series(::GLVisualizePackage, plt::Plot; kw...)
+function _add_series(::GLVisualizeBackend, plt::Plot; kw...)
d = Dict(kw)
# TODO: add one series to the underlying package
push!(plt.seriesargs, d)
@@ -37,7 +37,7 @@ function _add_series(::GLVisualizePackage, plt::Plot; kw...)
plt
end
-function _add_annotations{X,Y,V}(plt::Plot{GLVisualizePackage}, anns::AVec{@compat(Tuple{X,Y,V})})
+function _add_annotations{X,Y,V}(plt::Plot{GLVisualizeBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
for ann in anns
# TODO: add the annotation to the plot
end
@@ -45,28 +45,28 @@ end
# ----------------------------------------------------------------
-function _before_update_plot(plt::Plot{GLVisualizePackage})
+function _before_update_plot(plt::Plot{GLVisualizeBackend})
end
# TODO: override this to update plot items (title, xlabel, etc) after creation
-function _update_plot(plt::Plot{GLVisualizePackage}, d::Dict)
+function _update_plot(plt::Plot{GLVisualizeBackend}, d::Dict)
end
-function _update_plot_pos_size(plt::PlottingObject{GLVisualizePackage}, d::Dict)
+function _update_plot_pos_size(plt::AbstractPlot{GLVisualizeBackend}, d::Dict)
end
# ----------------------------------------------------------------
# accessors for x/y data
-function Base.getindex(plt::Plot{GLVisualizePackage}, i::Int)
+function Base.getindex(plt::Plot{GLVisualizeBackend}, i::Int)
# TODO:
# series = plt.o.lines[i]
# series.x, series.y
nothing, nothing
end
-function Base.setindex!(plt::Plot{GLVisualizePackage}, xy::Tuple, i::Integer)
+function Base.setindex!(plt::Plot{GLVisualizeBackend}, xy::Tuple, i::Integer)
# TODO:
# series = plt.o.lines[i]
# series.x, series.y = xy
@@ -75,25 +75,25 @@ end
# ----------------------------------------------------------------
-function _create_subplot(subplt::Subplot{GLVisualizePackage})
+function _create_subplot(subplt::Subplot{GLVisualizeBackend})
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example
end
-function _expand_limits(lims, plt::Plot{GLVisualizePackage}, isx::Bool)
+function _expand_limits(lims, plt::Plot{GLVisualizeBackend}, isx::Bool)
# TODO: call expand limits for each plot data
end
-function _remove_axis(plt::Plot{GLVisualizePackage}, isx::Bool)
+function _remove_axis(plt::Plot{GLVisualizeBackend}, isx::Bool)
# TODO: if plot is inner subplot, might need to remove ticks or axis labels
end
# ----------------------------------------------------------------
-function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{GLVisualizePackage})
+function Base.writemime(io::IO, ::MIME"image/png", plt::AbstractPlot{GLVisualizeBackend})
# TODO: write a png to io
end
-function Base.display(::PlotsDisplay, plt::Plot{GLVisualizePackage})
+function Base.display(::PlotsDisplay, plt::Plot{GLVisualizeBackend})
# TODO: display/show the plot
# NOTE: I think maybe this should be empty? We can start with the assumption that creating
@@ -101,6 +101,6 @@ function Base.display(::PlotsDisplay, plt::Plot{GLVisualizePackage})
# wouldn't actually need to do anything
end
-function Base.display(::PlotsDisplay, plt::Subplot{GLVisualizePackage})
+function Base.display(::PlotsDisplay, plt::Subplot{GLVisualizeBackend})
# TODO: display/show the subplot
end
diff --git a/src/backends/gr.jl b/src/backends/gr.jl
index 5f43a8c0..4e4e9f81 100644
--- a/src/backends/gr.jl
+++ b/src/backends/gr.jl
@@ -1,7 +1,7 @@
# https://github.com/jheinen/GR.jl
-function _initialize_backend(::GRPackage; kw...)
+function _initialize_backend(::GRBackend; kw...)
@eval begin
import GR
export GR
@@ -89,7 +89,7 @@ function gr_polyline(x, y)
end
end
-function gr_display(plt::Plot{GRPackage}, clear=true, update=true,
+function gr_display(plt::Plot{GRBackend}, clear=true, update=true,
subplot=[0, 1, 0, 1])
d = plt.plotargs
@@ -666,7 +666,7 @@ function gr_display(plt::Plot{GRPackage}, clear=true, update=true,
update && GR.updatews()
end
-function gr_display(subplt::Subplot{GRPackage})
+function gr_display(subplt::Subplot{GRBackend})
clear = true
update = false
l = enumerate(subplt.layout)
@@ -682,18 +682,18 @@ function gr_display(subplt::Subplot{GRPackage})
end
end
-function _create_plot(pkg::GRPackage; kw...)
+function _create_plot(pkg::GRBackend; kw...)
d = Dict(kw)
Plot(nothing, pkg, 0, d, Dict[])
end
-function _add_series(::GRPackage, plt::Plot; kw...)
+function _add_series(::GRBackend, plt::Plot; kw...)
d = Dict(kw)
push!(plt.seriesargs, d)
plt
end
-function _add_annotations{X,Y,V}(plt::Plot{GRPackage}, anns::AVec{@compat(Tuple{X,Y,V})})
+function _add_annotations{X,Y,V}(plt::Plot{GRBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
if haskey(plt.plotargs, :anns)
append!(plt.plotargs[:anns], anns)
else
@@ -703,26 +703,26 @@ end
# ----------------------------------------------------------------
-function _before_update_plot(plt::Plot{GRPackage})
+function _before_update_plot(plt::Plot{GRBackend})
end
-function _update_plot(plt::Plot{GRPackage}, d::Dict)
+function _update_plot(plt::Plot{GRBackend}, d::Dict)
for k in (:title, :xlabel, :ylabel)
haskey(d, k) && (plt.plotargs[k] = d[k])
end
end
-function _update_plot_pos_size(plt::PlottingObject{GRPackage}, d::Dict)
+function _update_plot_pos_size(plt::AbstractPlot{GRBackend}, d::Dict)
end
# ----------------------------------------------------------------
-function Base.getindex(plt::Plot{GRPackage}, i::Int)
+function Base.getindex(plt::Plot{GRBackend}, i::Int)
d = plt.seriesargs[i]
d[:x], d[:y]
end
-function Base.setindex!(plt::Plot{GRPackage}, xy::Tuple, i::Integer)
+function Base.setindex!(plt::Plot{GRBackend}, xy::Tuple, i::Integer)
d = plt.seriesargs[i]
d[:x], d[:y] = xy
plt
@@ -730,21 +730,21 @@ end
# ----------------------------------------------------------------
-function _create_subplot(subplt::Subplot{GRPackage}, isbefore::Bool)
+function _create_subplot(subplt::Subplot{GRBackend}, isbefore::Bool)
true
end
-function _expand_limits(lims, plt::Plot{GRPackage}, isx::Bool)
+function _expand_limits(lims, plt::Plot{GRBackend}, isx::Bool)
# TODO: call expand limits for each plot data
end
-function _remove_axis(plt::Plot{GRPackage}, isx::Bool)
+function _remove_axis(plt::Plot{GRBackend}, isx::Bool)
# TODO: if plot is inner subplot, might need to remove ticks or axis labels
end
# ----------------------------------------------------------------
-function Base.writemime(io::IO, m::MIME"image/png", plt::PlottingObject{GRPackage})
+function Base.writemime(io::IO, m::MIME"image/png", plt::AbstractPlot{GRBackend})
GR.emergencyclosegks()
ENV["GKS_WSTYPE"] = "png"
gr_display(plt)
@@ -752,7 +752,7 @@ function Base.writemime(io::IO, m::MIME"image/png", plt::PlottingObject{GRPackag
write(io, readall("gks.png"))
end
-function Base.writemime(io::IO, m::MIME"image/svg+xml", plt::PlottingObject{GRPackage})
+function Base.writemime(io::IO, m::MIME"image/svg+xml", plt::AbstractPlot{GRBackend})
GR.emergencyclosegks()
ENV["GKS_WSTYPE"] = "svg"
gr_display(plt)
@@ -760,11 +760,11 @@ function Base.writemime(io::IO, m::MIME"image/svg+xml", plt::PlottingObject{GRPa
write(io, readall("gks.svg"))
end
-function Base.writemime(io::IO, m::MIME"text/html", plt::PlottingObject{GRPackage})
+function Base.writemime(io::IO, m::MIME"text/html", plt::AbstractPlot{GRBackend})
writemime(io, MIME("image/svg+xml"), plt)
end
-function Base.writemime(io::IO, m::MIME"application/pdf", plt::PlottingObject{GRPackage})
+function Base.writemime(io::IO, m::MIME"application/pdf", plt::AbstractPlot{GRBackend})
GR.emergencyclosegks()
ENV["GKS_WSTYPE"] = "pdf"
gr_display(plt)
@@ -772,7 +772,7 @@ function Base.writemime(io::IO, m::MIME"application/pdf", plt::PlottingObject{GR
write(io, readall("gks.pdf"))
end
-function Base.writemime(io::IO, m::MIME"application/postscript", plt::PlottingObject{GRPackage})
+function Base.writemime(io::IO, m::MIME"application/postscript", plt::AbstractPlot{GRBackend})
GR.emergencyclosegks()
ENV["GKS_WSTYPE"] = "ps"
gr_display(plt)
@@ -780,11 +780,11 @@ function Base.writemime(io::IO, m::MIME"application/postscript", plt::PlottingOb
write(io, readall("gks.ps"))
end
-function Base.display(::PlotsDisplay, plt::Plot{GRPackage})
+function Base.display(::PlotsDisplay, plt::Plot{GRBackend})
gr_display(plt)
end
-function Base.display(::PlotsDisplay, plt::Subplot{GRPackage})
+function Base.display(::PlotsDisplay, plt::Subplot{GRBackend})
gr_display(plt)
true
end
diff --git a/src/backends/immerse.jl b/src/backends/immerse.jl
index 3eb6cfba..fcc210b9 100644
--- a/src/backends/immerse.jl
+++ b/src/backends/immerse.jl
@@ -1,7 +1,7 @@
# https://github.com/JuliaGraphics/Immerse.jl
-function _initialize_backend(::ImmersePackage; kw...)
+function _initialize_backend(::ImmerseBackend; kw...)
@eval begin
import Immerse, Gadfly, Compose, Gtk
export Immerse, Gadfly, Compose, Gtk
@@ -19,7 +19,7 @@ end
# create a blank Gadfly.Plot object
-function _create_plot(pkg::ImmersePackage; kw...)
+function _create_plot(pkg::ImmerseBackend; kw...)
d = Dict(kw)
# create the underlying Gadfly.Plot object
@@ -31,7 +31,7 @@ end
# plot one data series
-function _add_series(::ImmersePackage, plt::Plot; kw...)
+function _add_series(::ImmerseBackend, plt::Plot; kw...)
d = Dict(kw)
addGadflySeries!(plt, d)
push!(plt.seriesargs, d)
@@ -39,7 +39,7 @@ function _add_series(::ImmersePackage, plt::Plot; kw...)
end
-function _update_plot(plt::Plot{ImmersePackage}, d::Dict)
+function _update_plot(plt::Plot{ImmerseBackend}, d::Dict)
updateGadflyGuides(plt, d)
updateGadflyPlotTheme(plt, d)
end
@@ -48,7 +48,7 @@ end
# ----------------------------------------------------------------
-function _add_annotations{X,Y,V}(plt::Plot{ImmersePackage}, anns::AVec{@compat(Tuple{X,Y,V})})
+function _add_annotations{X,Y,V}(plt::Plot{ImmerseBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
for ann in anns
push!(getGadflyContext(plt).guides, createGadflyAnnotationObject(ann...))
end
@@ -58,12 +58,12 @@ end
# accessors for x/y data
-function Base.getindex(plt::Plot{ImmersePackage}, i::Integer)
+function Base.getindex(plt::Plot{ImmerseBackend}, i::Integer)
mapping = getGadflyMappings(plt, i)[1]
mapping[:x], mapping[:y]
end
-function Base.setindex!(plt::Plot{ImmersePackage}, xy::Tuple, i::Integer)
+function Base.setindex!(plt::Plot{ImmerseBackend}, xy::Tuple, i::Integer)
for mapping in getGadflyMappings(plt, i)
mapping[:x], mapping[:y] = xy
end
@@ -74,12 +74,12 @@ end
# ----------------------------------------------------------------
-function _create_subplot(subplt::Subplot{ImmersePackage}, isbefore::Bool)
+function _create_subplot(subplt::Subplot{ImmerseBackend}, isbefore::Bool)
return false
# isbefore && return false
end
-function showSubplotObject(subplt::Subplot{ImmersePackage})
+function showSubplotObject(subplt::Subplot{ImmerseBackend})
# create the Gtk window with vertical box vsep
d = getplotargs(subplt,1)
w,h = d[:size]
@@ -121,13 +121,13 @@ function showSubplotObject(subplt::Subplot{ImmersePackage})
end
-function _remove_axis(plt::Plot{ImmersePackage}, isx::Bool)
+function _remove_axis(plt::Plot{ImmerseBackend}, isx::Bool)
gplt = getGadflyContext(plt)
addOrReplace(gplt.guides, isx ? Gadfly.Guide.xticks : Gadfly.Guide.yticks; label=false)
addOrReplace(gplt.guides, isx ? Gadfly.Guide.xlabel : Gadfly.Guide.ylabel, "")
end
-function _expand_limits(lims, plt::Plot{ImmersePackage}, isx::Bool)
+function _expand_limits(lims, plt::Plot{ImmerseBackend}, isx::Bool)
for l in getGadflyContext(plt).layers
_expand_limits(lims, l.mapping[isx ? :x : :y])
end
@@ -136,11 +136,11 @@ end
# ----------------------------------------------------------------
-getGadflyContext(plt::Plot{ImmersePackage}) = plt.o[2]
-getGadflyContext(subplt::Subplot{ImmersePackage}) = buildGadflySubplotContext(subplt)
+getGadflyContext(plt::Plot{ImmerseBackend}) = plt.o[2]
+getGadflyContext(subplt::Subplot{ImmerseBackend}) = buildGadflySubplotContext(subplt)
-function Base.display(::PlotsDisplay, plt::Plot{ImmersePackage})
+function Base.display(::PlotsDisplay, plt::Plot{ImmerseBackend})
fig, gplt = plt.o
if fig == nothing
@@ -154,7 +154,7 @@ function Base.display(::PlotsDisplay, plt::Plot{ImmersePackage})
end
-function Base.display(::PlotsDisplay, subplt::Subplot{ImmersePackage})
+function Base.display(::PlotsDisplay, subplt::Subplot{ImmerseBackend})
# if we haven't created the window yet, do it
if subplt.o == nothing
diff --git a/src/backends/pgfplots.jl b/src/backends/pgfplots.jl
index f76cb33b..1b71568a 100644
--- a/src/backends/pgfplots.jl
+++ b/src/backends/pgfplots.jl
@@ -1,7 +1,7 @@
# https://github.com/sisl/PGFPlots.jl
-function _initialize_backend(::PGFPlotsPackage; kw...)
+function _initialize_backend(::PGFPlotsBackend; kw...)
@eval begin
import PGFPlots
export PGFPlots
@@ -12,7 +12,7 @@ end
# ---------------------------------------------------------------------------
-function _create_plot(pkg::PGFPlotsPackage; kw...)
+function _create_plot(pkg::PGFPlotsBackend; kw...)
d = Dict{Symbol,Any}(kw)
# TODO: create the window/canvas/context that is the plot within the backend (call it `o`)
# TODO: initialize the plot... title, xlabel, bgcolor, etc
@@ -20,14 +20,14 @@ function _create_plot(pkg::PGFPlotsPackage; kw...)
end
-function _add_series(::PGFPlotsPackage, plt::Plot; kw...)
+function _add_series(::PGFPlotsBackend, plt::Plot; kw...)
d = Dict{Symbol,Any}(kw)
# TODO: add one series to the underlying package
push!(plt.seriesargs, d)
plt
end
-function _add_annotations{X,Y,V}(plt::Plot{PGFPlotsPackage}, anns::AVec{@compat(Tuple{X,Y,V})})
+function _add_annotations{X,Y,V}(plt::Plot{PGFPlotsBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
# set or add to the annotation_list
if haskey(plt.plotargs, :annotation_list)
append!(plt.plotargs[:annotation_list], anns)
@@ -38,26 +38,26 @@ end
# ----------------------------------------------------------------
-function _before_update_plot(plt::Plot{PGFPlotsPackage})
+function _before_update_plot(plt::Plot{PGFPlotsBackend})
end
# TODO: override this to update plot items (title, xlabel, etc) after creation
-function _update_plot(plt::Plot{PGFPlotsPackage}, d::Dict)
+function _update_plot(plt::Plot{PGFPlotsBackend}, d::Dict)
end
-function _update_plot_pos_size(plt::PlottingObject{PGFPlotsPackage}, d::Dict)
+function _update_plot_pos_size(plt::AbstractPlot{PGFPlotsBackend}, d::Dict)
end
# ----------------------------------------------------------------
# accessors for x/y data
-function Base.getindex(plt::Plot{PGFPlotsPackage}, i::Int)
+function Base.getindex(plt::Plot{PGFPlotsBackend}, i::Int)
d = plt.seriesargs[i]
d[:x], d[:y]
end
-function Base.setindex!(plt::Plot{PGFPlotsPackage}, xy::Tuple, i::Integer)
+function Base.setindex!(plt::Plot{PGFPlotsBackend}, xy::Tuple, i::Integer)
d = plt.seriesargs[i]
d[:x], d[:y] = xy
plt
@@ -65,16 +65,16 @@ end
# ----------------------------------------------------------------
-function _create_subplot(subplt::Subplot{PGFPlotsPackage}, isbefore::Bool)
+function _create_subplot(subplt::Subplot{PGFPlotsBackend}, isbefore::Bool)
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example
true
end
-function _expand_limits(lims, plt::Plot{PGFPlotsPackage}, isx::Bool)
+function _expand_limits(lims, plt::Plot{PGFPlotsBackend}, isx::Bool)
# TODO: call expand limits for each plot data
end
-function _remove_axis(plt::Plot{PGFPlotsPackage}, isx::Bool)
+function _remove_axis(plt::Plot{PGFPlotsBackend}, isx::Bool)
# TODO: if plot is inner subplot, might need to remove ticks or axis labels
end
@@ -84,24 +84,24 @@ end
# ----------------------------------------------------------------
################# This is the important method to implement!!! #################
-function _make_pgf_plot(plt::Plot{PGFPlotsPackage})
+function _make_pgf_plot(plt::Plot{PGFPlotsBackend})
# TODO: convert plt.plotargs and plt.seriesargs into PGFPlots calls
# TODO: return the PGFPlots object
end
-function Base.writemime(io::IO, mime::MIME"image/png", plt::PlottingObject{PGFPlotsPackage})
+function Base.writemime(io::IO, mime::MIME"image/png", plt::AbstractPlot{PGFPlotsBackend})
plt.o = _make_pgf_plot(plt)
writemime(io, mime, plt.o)
end
-# function Base.writemime(io::IO, ::MIME"text/html", plt::PlottingObject{PGFPlotsPackage})
+# function Base.writemime(io::IO, ::MIME"text/html", plt::AbstractPlot{PGFPlotsBackend})
# end
-function Base.display(::PlotsDisplay, plt::PlottingObject{PGFPlotsPackage})
+function Base.display(::PlotsDisplay, plt::AbstractPlot{PGFPlotsBackend})
plt.o = _make_pgf_plot(plt)
display(plt.o)
end
-# function Base.display(::PlotsDisplay, plt::Subplot{PGFPlotsPackage})
+# function Base.display(::PlotsDisplay, plt::Subplot{PGFPlotsBackend})
# # TODO: display/show the subplot
# end
diff --git a/src/backends/plotly.jl b/src/backends/plotly.jl
index bf8614bc..e7c24383 100644
--- a/src/backends/plotly.jl
+++ b/src/backends/plotly.jl
@@ -1,7 +1,7 @@
# https://plot.ly/javascript/getting-started
-function _initialize_backend(::PlotlyPackage; kw...)
+function _initialize_backend(::PlotlyBackend; kw...)
@eval begin
import JSON
JSON._print(io::IO, state::JSON.State, dt::Union{Date,DateTime}) = print(io, '"', dt, '"')
@@ -33,7 +33,7 @@ end
# ---------------------------------------------------------------------------
-function _create_plot(pkg::PlotlyPackage; kw...)
+function _create_plot(pkg::PlotlyBackend; kw...)
d = Dict{Symbol,Any}(kw)
# TODO: create the window/canvas/context that is the plot within the backend (call it `o`)
# TODO: initialize the plot... title, xlabel, bgcolor, etc
@@ -41,14 +41,14 @@ function _create_plot(pkg::PlotlyPackage; kw...)
end
-function _add_series(::PlotlyPackage, plt::Plot; kw...)
+function _add_series(::PlotlyBackend, plt::Plot; kw...)
d = Dict{Symbol,Any}(kw)
# TODO: add one series to the underlying package
push!(plt.seriesargs, d)
plt
end
-function _add_annotations{X,Y,V}(plt::Plot{PlotlyPackage}, anns::AVec{@compat(Tuple{X,Y,V})})
+function _add_annotations{X,Y,V}(plt::Plot{PlotlyBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
# set or add to the annotation_list
if haskey(plt.plotargs, :annotation_list)
append!(plt.plotargs[:annotation_list], anns)
@@ -59,26 +59,26 @@ end
# ----------------------------------------------------------------
-function _before_update_plot(plt::Plot{PlotlyPackage})
+function _before_update_plot(plt::Plot{PlotlyBackend})
end
# TODO: override this to update plot items (title, xlabel, etc) after creation
-function _update_plot(plt::Plot{PlotlyPackage}, d::Dict)
+function _update_plot(plt::Plot{PlotlyBackend}, d::Dict)
end
-function _update_plot_pos_size(plt::PlottingObject{PlotlyPackage}, d::Dict)
+function _update_plot_pos_size(plt::AbstractPlot{PlotlyBackend}, d::Dict)
end
# ----------------------------------------------------------------
# accessors for x/y data
-function Base.getindex(plt::Plot{PlotlyPackage}, i::Int)
+function Base.getindex(plt::Plot{PlotlyBackend}, i::Int)
d = plt.seriesargs[i]
d[:x], d[:y]
end
-function Base.setindex!(plt::Plot{PlotlyPackage}, xy::Tuple, i::Integer)
+function Base.setindex!(plt::Plot{PlotlyBackend}, xy::Tuple, i::Integer)
d = plt.seriesargs[i]
d[:x], d[:y] = xy
plt
@@ -86,16 +86,16 @@ end
# ----------------------------------------------------------------
-function _create_subplot(subplt::Subplot{PlotlyPackage}, isbefore::Bool)
+function _create_subplot(subplt::Subplot{PlotlyBackend}, isbefore::Bool)
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example
true
end
-function _expand_limits(lims, plt::Plot{PlotlyPackage}, isx::Bool)
+function _expand_limits(lims, plt::Plot{PlotlyBackend}, isx::Bool)
# TODO: call expand limits for each plot data
end
-function _remove_axis(plt::Plot{PlotlyPackage}, isx::Bool)
+function _remove_axis(plt::Plot{PlotlyBackend}, isx::Bool)
# TODO: if plot is inner subplot, might need to remove ticks or axis labels
end
@@ -206,7 +206,7 @@ function plotlyaxis(d::Dict, isx::Bool)
ax
end
-# function get_plot_json(plt::Plot{PlotlyPackage})
+# function get_plot_json(plt::Plot{PlotlyBackend})
# d = plt.plotargs
function plotly_layout(d::Dict)
d_out = Dict{Symbol,Any}()
@@ -244,7 +244,7 @@ function plotly_layout(d::Dict)
d_out
end
-function get_plot_json(plt::Plot{PlotlyPackage})
+function get_plot_json(plt::Plot{PlotlyBackend})
JSON.json(plotly_layout(plt.plotargs))
end
@@ -410,11 +410,11 @@ function plotly_series(d::Dict; plot_index = nothing)
end
# get a list of dictionaries, each representing the series params
-function get_series_json(plt::Plot{PlotlyPackage})
+function get_series_json(plt::Plot{PlotlyBackend})
JSON.json(map(plotly_series, plt.seriesargs))
end
-function get_series_json(subplt::Subplot{PlotlyPackage})
+function get_series_json(subplt::Subplot{PlotlyBackend})
ds = Dict[]
for (i,plt) in enumerate(subplt.plts)
for d in plt.seriesargs
@@ -426,11 +426,11 @@ end
# ----------------------------------------------------------------
-function html_head(plt::PlottingObject{PlotlyPackage})
+function html_head(plt::AbstractPlot{PlotlyBackend})
""
end
-function html_body(plt::Plot{PlotlyPackage}, style = nothing)
+function html_body(plt::Plot{PlotlyBackend}, style = nothing)
if style == nothing
w, h = plt.plotargs[:size]
style = "width:$(w)px;height:$(h)px;"
@@ -447,7 +447,7 @@ end
-function html_body(subplt::Subplot{PlotlyPackage})
+function html_body(subplt::Subplot{PlotlyBackend})
w, h = subplt.plts[1].plotargs[:size]
html = ["
"]
nr = nrows(subplt.layout)
@@ -474,18 +474,18 @@ end
# ----------------------------------------------------------------
-function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{PlotlyPackage})
+function Base.writemime(io::IO, ::MIME"image/png", plt::AbstractPlot{PlotlyBackend})
warn("todo: png")
end
-function Base.writemime(io::IO, ::MIME"text/html", plt::PlottingObject{PlotlyPackage})
+function Base.writemime(io::IO, ::MIME"text/html", plt::AbstractPlot{PlotlyBackend})
write(io, html_head(plt) * html_body(plt))
end
-function Base.display(::PlotsDisplay, plt::PlottingObject{PlotlyPackage})
+function Base.display(::PlotsDisplay, plt::AbstractPlot{PlotlyBackend})
standalone_html_window(plt)
end
-# function Base.display(::PlotsDisplay, plt::Subplot{PlotlyPackage})
+# function Base.display(::PlotsDisplay, plt::Subplot{PlotlyBackend})
# # TODO: display/show the subplot
# end
diff --git a/src/backends/plotlyjs.jl b/src/backends/plotlyjs.jl
index ab40ec80..1f12358f 100644
--- a/src/backends/plotlyjs.jl
+++ b/src/backends/plotlyjs.jl
@@ -1,25 +1,25 @@
# https://github.com/spencerlyon2/PlotlyJS.jl
-function _initialize_backend(::PlotlyJSPackage; kw...)
+function _initialize_backend(::PlotlyJSBackend; kw...)
@eval begin
import PlotlyJS
export PlotlyJS
end
for (mime, fmt) in PlotlyJS._mimeformats
- @eval Base.writemime(io::IO, m::MIME{symbol($mime)}, p::Plot{PlotlyJSPackage}) = writemime(io, m, p.o)
+ @eval Base.writemime(io::IO, m::MIME{symbol($mime)}, p::Plot{PlotlyJSBackend}) = writemime(io, m, p.o)
end
# override IJulia inline display
if isijulia()
- IJulia.display_dict(plt::PlottingObject{PlotlyJSPackage}) = IJulia.display_dict(plt.o)
+ IJulia.display_dict(plt::AbstractPlot{PlotlyJSBackend}) = IJulia.display_dict(plt.o)
end
end
# ---------------------------------------------------------------------------
-function _create_plot(pkg::PlotlyJSPackage; kw...)
+function _create_plot(pkg::PlotlyJSBackend; kw...)
d = Dict(kw)
# TODO: create the window/canvas/context that is the plot within the backend (call it `o`)
# TODO: initialize the plot... title, xlabel, bgcolor, etc
@@ -33,7 +33,7 @@ function _create_plot(pkg::PlotlyJSPackage; kw...)
end
-function _add_series(::PlotlyJSPackage, plt::Plot; kw...)
+function _add_series(::PlotlyJSBackend, plt::Plot; kw...)
d = Dict(kw)
syncplot = plt.o
@@ -53,7 +53,7 @@ end
# ---------------------------------------------------------------------------
-function _add_annotations{X,Y,V}(plt::Plot{PlotlyJSPackage}, anns::AVec{@compat(Tuple{X,Y,V})})
+function _add_annotations{X,Y,V}(plt::Plot{PlotlyJSBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
# set or add to the annotation_list
if !haskey(plt.plotargs, :annotation_list)
plt.plotargs[:annotation_list] = Any[]
@@ -63,11 +63,11 @@ end
# ----------------------------------------------------------------
-function _before_update_plot(plt::Plot{PlotlyJSPackage})
+function _before_update_plot(plt::Plot{PlotlyJSBackend})
end
# TODO: override this to update plot items (title, xlabel, etc) after creation
-function _update_plot(plt::Plot{PlotlyJSPackage}, d::Dict)
+function _update_plot(plt::Plot{PlotlyJSBackend}, d::Dict)
pdict = plotly_layout(d)
# dumpdict(pdict, "pdict updateplot", true)
syncplot = plt.o
@@ -76,19 +76,19 @@ function _update_plot(plt::Plot{PlotlyJSPackage}, d::Dict)
end
-function _update_plot_pos_size(plt::PlottingObject{PlotlyJSPackage}, d::Dict)
+function _update_plot_pos_size(plt::AbstractPlot{PlotlyJSBackend}, d::Dict)
end
# ----------------------------------------------------------------
# accessors for x/y data
-function Base.getindex(plt::Plot{PlotlyJSPackage}, i::Int)
+function Base.getindex(plt::Plot{PlotlyJSBackend}, i::Int)
d = plt.seriesargs[i]
d[:x], d[:y]
end
-function Base.setindex!(plt::Plot{PlotlyJSPackage}, xy::Tuple, i::Integer)
+function Base.setindex!(plt::Plot{PlotlyJSBackend}, xy::Tuple, i::Integer)
d = plt.seriesargs[i]
d[:x], d[:y] = xy
# TODO: this is likely ineffecient... we should make a call that ONLY changes the plot data
@@ -99,30 +99,30 @@ end
# ----------------------------------------------------------------
-function _create_subplot(subplt::Subplot{PlotlyJSPackage}, isbefore::Bool)
+function _create_subplot(subplt::Subplot{PlotlyJSBackend}, isbefore::Bool)
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example
true
end
-function _expand_limits(lims, plt::Plot{PlotlyJSPackage}, isx::Bool)
+function _expand_limits(lims, plt::Plot{PlotlyJSBackend}, isx::Bool)
# TODO: call expand limits for each plot data
end
-function _remove_axis(plt::Plot{PlotlyJSPackage}, isx::Bool)
+function _remove_axis(plt::Plot{PlotlyJSBackend}, isx::Bool)
# TODO: if plot is inner subplot, might need to remove ticks or axis labels
end
# ----------------------------------------------------------------
-function Base.writemime(io::IO, m::MIME"text/html", plt::PlottingObject{PlotlyJSPackage})
+function Base.writemime(io::IO, m::MIME"text/html", plt::AbstractPlot{PlotlyJSBackend})
Base.writemime(io, m, plt.o)
end
-function Base.display(::PlotsDisplay, plt::Plot{PlotlyJSPackage})
+function Base.display(::PlotsDisplay, plt::Plot{PlotlyJSBackend})
display(plt.o)
end
-function Base.display(::PlotsDisplay, plt::Subplot{PlotlyJSPackage})
+function Base.display(::PlotsDisplay, plt::Subplot{PlotlyJSBackend})
error()
end
diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl
index cb19ec86..9624af54 100644
--- a/src/backends/pyplot.jl
+++ b/src/backends/pyplot.jl
@@ -1,7 +1,7 @@
# https://github.com/stevengj/PyPlot.jl
-function _initialize_backend(::PyPlotPackage)
+function _initialize_backend(::PyPlotBackend)
@eval begin
import PyPlot
export PyPlot
@@ -149,9 +149,9 @@ function getRightAxis(wrap::PyPlotAxisWrapper)
wrap.rightax
end
-getLeftAxis(plt::Plot{PyPlotPackage}) = getLeftAxis(plt.o)
-getRightAxis(plt::Plot{PyPlotPackage}) = getRightAxis(plt.o)
-getAxis(plt::Plot{PyPlotPackage}, axis::Symbol) = (axis == :right ? getRightAxis : getLeftAxis)(plt)
+getLeftAxis(plt::Plot{PyPlotBackend}) = getLeftAxis(plt.o)
+getRightAxis(plt::Plot{PyPlotBackend}) = getRightAxis(plt.o)
+getAxis(plt::Plot{PyPlotBackend}, axis::Symbol) = (axis == :right ? getRightAxis : getLeftAxis)(plt)
# left axis is PyPlot., right axis is "f.axes[0].twinx()."
function getPyPlotFunction(plt::Plot, axis::Symbol, linetype::Symbol)
@@ -196,7 +196,7 @@ function updateAxisColors(ax, fgcolor)
end
-function handleSmooth(plt::Plot{PyPlotPackage}, ax, d::Dict, smooth::Bool)
+function handleSmooth(plt::Plot{PyPlotBackend}, ax, d::Dict, smooth::Bool)
if smooth
xs, ys = regressionXY(d[:x], d[:y])
ax[:plot](xs, ys,
@@ -206,7 +206,7 @@ function handleSmooth(plt::Plot{PyPlotPackage}, ax, d::Dict, smooth::Bool)
)
end
end
-handleSmooth(plt::Plot{PyPlotPackage}, ax, d::Dict, smooth::Real) = handleSmooth(plt, ax, d, true)
+handleSmooth(plt::Plot{PyPlotBackend}, ax, d::Dict, smooth::Real) = handleSmooth(plt, ax, d, true)
@@ -214,10 +214,10 @@ 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}) = plt.o == nothing ? nothing : makePyPlotCurrent(plt.o)
+makePyPlotCurrent(plt::Plot{PyPlotBackend}) = plt.o == nothing ? nothing : makePyPlotCurrent(plt.o)
-function _before_add_series(plt::Plot{PyPlotPackage})
+function _before_add_series(plt::Plot{PyPlotBackend})
makePyPlotCurrent(plt)
end
@@ -267,7 +267,7 @@ end
# screen # Integer, move enclosing window to this screen number (for multiscreen desktops)
# show # true or false, show the plot (in case you don't want the window to pop up right away)
-function _create_plot(pkg::PyPlotPackage; kw...)
+function _create_plot(pkg::PyPlotBackend; kw...)
# create the figure
d = Dict(kw)
@@ -289,7 +289,7 @@ function _create_plot(pkg::PyPlotPackage; kw...)
end
-function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
+function _add_series(pkg::PyPlotBackend, plt::Plot; kw...)
d = Dict(kw)
# 3D plots have a different underlying Axes object in PyPlot
@@ -508,7 +508,7 @@ end
# -----------------------------------------------------------------
-function Base.getindex(plt::Plot{PyPlotPackage}, i::Integer)
+function Base.getindex(plt::Plot{PyPlotBackend}, i::Integer)
series = plt.seriesargs[i][:serieshandle]
try
return series[:get_data]()
@@ -540,7 +540,7 @@ function minmaxseries(ds, vec, axis)
end
# TODO: this needs to handle one-sided fixed limits
-function set_lims!(plt::Plot{PyPlotPackage}, axis::Symbol)
+function set_lims!(plt::Plot{PyPlotBackend}, axis::Symbol)
ax = getAxis(plt, axis)
if plt.plotargs[:xlims] == :auto
ax[:set_xlim](minmaxseries(plt.seriesargs, :x, axis)...)
@@ -550,7 +550,7 @@ function set_lims!(plt::Plot{PyPlotPackage}, axis::Symbol)
end
end
-function Base.setindex!{X,Y}(plt::Plot{PyPlotPackage}, xy::Tuple{X,Y}, i::Integer)
+function Base.setindex!{X,Y}(plt::Plot{PyPlotBackend}, xy::Tuple{X,Y}, i::Integer)
d = plt.seriesargs[i]
series = d[:serieshandle]
x, y = xy
@@ -565,7 +565,7 @@ function Base.setindex!{X,Y}(plt::Plot{PyPlotPackage}, xy::Tuple{X,Y}, i::Intege
plt
end
-function Base.setindex!{X,Y,Z}(plt::Plot{PyPlotPackage}, xyz::Tuple{X,Y,Z}, i::Integer)
+function Base.setindex!{X,Y,Z}(plt::Plot{PyPlotBackend}, xyz::Tuple{X,Y,Z}, i::Integer)
warn("setindex not implemented for xyz")
plt
end
@@ -605,9 +605,9 @@ function addPyPlotTicks(ax, ticks, isx::Bool)
end
end
-usingRightAxis(plt::Plot{PyPlotPackage}) = any(args -> args[:axis] in (:right,:auto), plt.seriesargs)
+usingRightAxis(plt::Plot{PyPlotBackend}) = any(args -> args[:axis] in (:right,:auto), plt.seriesargs)
-function _update_plot(plt::Plot{PyPlotPackage}, d::Dict)
+function _update_plot(plt::Plot{PyPlotBackend}, d::Dict)
figorax = plt.o
ax = getLeftAxis(figorax)
# PyPlot.sca(ax)
@@ -686,13 +686,13 @@ end
# -----------------------------------------------------------------
-function createPyPlotAnnotationObject(plt::Plot{PyPlotPackage}, x, y, val::@compat(AbstractString))
+function createPyPlotAnnotationObject(plt::Plot{PyPlotBackend}, x, y, val::@compat(AbstractString))
ax = getLeftAxis(plt)
ax[:annotate](val, xy = (x,y))
end
-function createPyPlotAnnotationObject(plt::Plot{PyPlotPackage}, x, y, val::PlotText)
+function createPyPlotAnnotationObject(plt::Plot{PyPlotBackend}, x, y, val::PlotText)
ax = getLeftAxis(plt)
ax[:annotate](val.str,
xy = (x,y),
@@ -705,7 +705,7 @@ function createPyPlotAnnotationObject(plt::Plot{PyPlotPackage}, x, y, val::PlotT
)
end
-function _add_annotations{X,Y,V}(plt::Plot{PyPlotPackage}, anns::AVec{@compat(Tuple{X,Y,V})})
+function _add_annotations{X,Y,V}(plt::Plot{PyPlotBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
for ann in anns
createPyPlotAnnotationObject(plt, ann...)
end
@@ -714,7 +714,7 @@ end
# -----------------------------------------------------------------
# NOTE: pyplot needs to build before
-function _create_subplot(subplt::Subplot{PyPlotPackage}, isbefore::Bool)
+function _create_subplot(subplt::Subplot{PyPlotBackend}, isbefore::Bool)
l = subplt.layout
# w,h = map(px2inch, getplotargs(subplt,1)[:size])
@@ -743,16 +743,16 @@ end
# this will be called internally, when creating a subplot from existing plots
# NOTE: if I ever need to "Rebuild a "ubplot from individual Plot's"... this is what I should use!
-function subplot(plts::AVec{Plot{PyPlotPackage}}, layout::SubplotLayout, d::Dict)
+function subplot(plts::AVec{Plot{PyPlotBackend}}, layout::SubplotLayout, d::Dict)
validateSubplotSupported()
p = length(layout)
n = sum([plt.n for plt in plts])
- pkg = PyPlotPackage()
- newplts = Plot{PyPlotPackage}[_create_plot(pkg; subplot=true, plt.plotargs...) for plt in plts]
+ pkg = PyPlotBackend()
+ newplts = Plot{PyPlotBackend}[_create_plot(pkg; subplot=true, plt.plotargs...) for plt in plts]
- subplt = Subplot(nothing, newplts, PyPlotPackage(), p, n, layout, d, true, false, false, (r,c) -> (nothing,nothing))
+ subplt = Subplot(nothing, newplts, PyPlotBackend(), p, n, layout, d, true, false, false, (r,c) -> (nothing,nothing))
_preprocess_subplot(subplt, d)
_create_subplot(subplt, true)
@@ -769,7 +769,7 @@ function subplot(plts::AVec{Plot{PyPlotPackage}}, layout::SubplotLayout, d::Dict
end
-function _remove_axis(plt::Plot{PyPlotPackage}, isx::Bool)
+function _remove_axis(plt::Plot{PyPlotBackend}, isx::Bool)
if isx
plot!(plt, xticks=zeros(0), xlabel="")
else
@@ -777,7 +777,7 @@ function _remove_axis(plt::Plot{PyPlotPackage}, isx::Bool)
end
end
-function _expand_limits(lims, plt::Plot{PyPlotPackage}, isx::Bool)
+function _expand_limits(lims, plt::Plot{PyPlotBackend}, isx::Bool)
pltlims = plt.o.ax[isx ? :get_xbound : :get_ybound]()
_expand_limits(lims, pltlims)
end
@@ -810,14 +810,14 @@ function addPyPlotLegend(plt::Plot, ax)
end
end
-function finalizePlot(plt::Plot{PyPlotPackage})
+function finalizePlot(plt::Plot{PyPlotBackend})
ax = getLeftAxis(plt)
addPyPlotLegend(plt, ax)
updateAxisColors(ax, getPyPlotColor(plt.plotargs[:foreground_color]))
PyPlot.draw()
end
-function finalizePlot(subplt::Subplot{PyPlotPackage})
+function finalizePlot(subplt::Subplot{PyPlotBackend})
fig = subplt.o.fig
for (i,plt) in enumerate(subplt.plts)
ax = getLeftAxis(plt)
@@ -830,20 +830,20 @@ end
# # allow for writing any supported mime
# for mime in keys(PyPlot.aggformats)
-# @eval function Base.writemime(io::IO, m::MIME{symbol{$mime}}, plt::Plot{PyPlotPackage})
+# @eval function Base.writemime(io::IO, m::MIME{symbol{$mime}}, plt::Plot{PyPlotBackend})
# finalizePlot(plt)
# writemime(io, m, getfig(plt.o))
# end
# end
-# function Base.writemime(io::IO, m::@compat(Union{MIME"image/svg+xml", MIME"image/png"}, plt::Plot{PyPlotPackage})
+# function Base.writemime(io::IO, m::@compat(Union{MIME"image/svg+xml", MIME"image/png"}, plt::Plot{PyPlotBackend})
# finalizePlot(plt)
# writemime(io, m, getfig(plt.o))
# end
# NOTE: to bring up a GUI window in IJulia, need some extra steps
-function Base.display(::PlotsDisplay, plt::PlottingObject{PyPlotPackage})
+function Base.display(::PlotsDisplay, plt::AbstractPlot{PyPlotBackend})
finalizePlot(plt)
if isa(Base.Multimedia.displays[end], Base.REPL.REPLDisplay)
display(getfig(plt.o))
@@ -858,7 +858,7 @@ function Base.display(::PlotsDisplay, plt::PlottingObject{PyPlotPackage})
end
-# function Base.display(::PlotsDisplay, subplt::Subplot{PyPlotPackage})
+# function Base.display(::PlotsDisplay, subplt::Subplot{PyPlotBackend})
# finalizePlot(subplt)
# PyPlot.ion()
# PyPlot.figure(getfig(subplt.o).o[:number])
@@ -869,7 +869,7 @@ end
# # allow for writing any supported mime
# for mime in (MIME"image/png", MIME"application/pdf", MIME"application/postscript")
-# @eval function Base.writemime(io::IO, ::$mime, plt::PlottingObject{PyPlotPackage})
+# @eval function Base.writemime(io::IO, ::$mime, plt::AbstractPlot{PyPlotBackend})
# finalizePlot(plt)
# writemime(io, $mime(), getfig(plt.o))
# end
@@ -886,7 +886,7 @@ const _pyplot_mimeformats = @compat Dict(
for (mime, fmt) in _pyplot_mimeformats
- @eval function Base.writemime(io::IO, ::MIME{symbol($mime)}, plt::PlottingObject{PyPlotPackage})
+ @eval function Base.writemime(io::IO, ::MIME{symbol($mime)}, plt::AbstractPlot{PyPlotBackend})
finalizePlot(plt)
fig = getfig(plt.o)
fig.o["canvas"][:print_figure](io,
@@ -901,7 +901,7 @@ for (mime, fmt) in _pyplot_mimeformats
end
-# function Base.writemime(io::IO, m::MIME"image/png", subplt::Subplot{PyPlotPackage})
+# function Base.writemime(io::IO, m::MIME"image/png", subplt::Subplot{PyPlotBackend})
# finalizePlot(subplt)
# writemime(io, m, getfig(subplt.o))
# end
diff --git a/src/backends/qwt.jl b/src/backends/qwt.jl
index a6b09088..e512009c 100644
--- a/src/backends/qwt.jl
+++ b/src/backends/qwt.jl
@@ -1,7 +1,7 @@
# https://github.com/tbreloff/Qwt.jl
-function _initialize_backend(::QwtPackage; kw...)
+function _initialize_backend(::QwtBackend; kw...)
@eval begin
warn("Qwt is no longer supported... many features will likely be broken.")
import Qwt
@@ -38,7 +38,7 @@ function replaceQwtAliases(d, s)
end
end
-function adjustQwtKeywords(plt::Plot{QwtPackage}, iscreating::Bool; kw...)
+function adjustQwtKeywords(plt::Plot{QwtBackend}, iscreating::Bool; kw...)
d = Dict(kw)
lt = d[:linetype]
if lt == :scatter
@@ -77,7 +77,7 @@ function adjustQwtKeywords(plt::Plot{QwtPackage}, iscreating::Bool; kw...)
d
end
-function _create_plot(pkg::QwtPackage; kw...)
+function _create_plot(pkg::QwtBackend; kw...)
d = Dict(kw)
fixcolors(d)
dumpdict(d,"\n\n!!! plot")
@@ -86,7 +86,7 @@ function _create_plot(pkg::QwtPackage; kw...)
plt
end
-function _add_series(::QwtPackage, plt::Plot; kw...)
+function _add_series(::QwtBackend, plt::Plot; kw...)
d = adjustQwtKeywords(plt, false; kw...)
fixcolors(d)
dumpdict(d,"\n\n!!! plot!")
@@ -98,7 +98,7 @@ end
# ----------------------------------------------------------------
-function updateLimsAndTicks(plt::Plot{QwtPackage}, d::Dict, isx::Bool)
+function updateLimsAndTicks(plt::Plot{QwtBackend}, d::Dict, isx::Bool)
lims = get(d, isx ? :xlims : :ylims, nothing)
ticks = get(d, isx ? :xticks : :yticks, nothing)
w = plt.o.widget
@@ -138,7 +138,7 @@ function updateLimsAndTicks(plt::Plot{QwtPackage}, d::Dict, isx::Bool)
end
-function _update_plot(plt::Plot{QwtPackage}, d::Dict)
+function _update_plot(plt::Plot{QwtBackend}, d::Dict)
haskey(d, :title) && Qwt.title(plt.o, d[:title])
haskey(d, :xlabel) && Qwt.xlabel(plt.o, d[:xlabel])
haskey(d, :ylabel) && Qwt.ylabel(plt.o, d[:ylabel])
@@ -146,7 +146,7 @@ function _update_plot(plt::Plot{QwtPackage}, d::Dict)
updateLimsAndTicks(plt, d, false)
end
-function _update_plot_pos_size(plt::PlottingObject{QwtPackage}, d::Dict)
+function _update_plot_pos_size(plt::AbstractPlot{QwtBackend}, d::Dict)
haskey(d, :size) && Qwt.resizewidget(plt.o, d[:size]...)
haskey(d, :pos) && Qwt.movewidget(plt.o, d[:pos]...)
end
@@ -155,7 +155,7 @@ end
# ----------------------------------------------------------------
# curve.setPen(Qt.QPen(Qt.QColor(color), linewidth, self.getLineStyle(linestyle)))
-function addLineMarker(plt::Plot{QwtPackage}, d::Dict)
+function addLineMarker(plt::Plot{QwtBackend}, d::Dict)
for yi in d[:y]
marker = Qwt.QWT.QwtPlotMarker()
ishorizontal = (d[:linetype] == :hline)
@@ -189,7 +189,7 @@ function createQwtAnnotation(plt::Plot, x, y, val::@compat(AbstractString))
marker[:attach](plt.o.widget)
end
-function _add_annotations{X,Y,V}(plt::Plot{QwtPackage}, anns::AVec{@compat(Tuple{X,Y,V})})
+function _add_annotations{X,Y,V}(plt::Plot{QwtBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
for ann in anns
createQwtAnnotation(plt, ann...)
end
@@ -199,12 +199,12 @@ end
# accessors for x/y data
-function Base.getindex(plt::Plot{QwtPackage}, i::Int)
+function Base.getindex(plt::Plot{QwtBackend}, i::Int)
series = plt.o.lines[i]
series.x, series.y
end
-function Base.setindex!(plt::Plot{QwtPackage}, xy::Tuple, i::Integer)
+function Base.setindex!(plt::Plot{QwtBackend}, xy::Tuple, i::Integer)
series = plt.o.lines[i]
series.x, series.y = xy
plt
@@ -213,12 +213,12 @@ end
# -------------------------------
-# savepng(::QwtPackage, plt::PlottingObject, fn::@compat(AbstractString), args...) = Qwt.savepng(plt.o, fn)
+# savepng(::QwtBackend, plt::AbstractPlot, fn::@compat(AbstractString), args...) = Qwt.savepng(plt.o, fn)
# -------------------------------
# create the underlying object (each backend will do this differently)
-function _create_subplot(subplt::Subplot{QwtPackage}, isbefore::Bool)
+function _create_subplot(subplt::Subplot{QwtBackend}, isbefore::Bool)
isbefore && return false
i = 0
rows = Any[]
@@ -240,26 +240,26 @@ function _create_subplot(subplt::Subplot{QwtPackage}, isbefore::Bool)
true
end
-function _expand_limits(lims, plt::Plot{QwtPackage}, isx::Bool)
+function _expand_limits(lims, plt::Plot{QwtBackend}, isx::Bool)
for series in plt.o.lines
_expand_limits(lims, isx ? series.x : series.y)
end
end
-function _remove_axis(plt::Plot{QwtPackage}, isx::Bool)
+function _remove_axis(plt::Plot{QwtBackend}, isx::Bool)
end
# ----------------------------------------------------------------
-function Base.writemime(io::IO, ::MIME"image/png", plt::Plot{QwtPackage})
+function Base.writemime(io::IO, ::MIME"image/png", plt::Plot{QwtBackend})
Qwt.refresh(plt.o)
Qwt.savepng(plt.o, "/tmp/dfskjdhfkh.png")
write(io, readall("/tmp/dfskjdhfkh.png"))
end
-function Base.writemime(io::IO, ::MIME"image/png", subplt::Subplot{QwtPackage})
+function Base.writemime(io::IO, ::MIME"image/png", subplt::Subplot{QwtBackend})
for plt in subplt.plts
Qwt.refresh(plt.o)
end
@@ -268,12 +268,12 @@ function Base.writemime(io::IO, ::MIME"image/png", subplt::Subplot{QwtPackage})
end
-function Base.display(::PlotsDisplay, plt::Plot{QwtPackage})
+function Base.display(::PlotsDisplay, plt::Plot{QwtBackend})
Qwt.refresh(plt.o)
Qwt.showwidget(plt.o)
end
-function Base.display(::PlotsDisplay, subplt::Subplot{QwtPackage})
+function Base.display(::PlotsDisplay, subplt::Subplot{QwtBackend})
for plt in subplt.plts
Qwt.refresh(plt.o)
end
diff --git a/src/backends/supported.jl b/src/backends/supported.jl
index 0ba5ff49..11168686 100644
--- a/src/backends/supported.jl
+++ b/src/backends/supported.jl
@@ -1,11 +1,11 @@
-supportedAxes(::PlottingPackage) = [:left]
-supportedTypes(::PlottingPackage) = []
-supportedStyles(::PlottingPackage) = [:solid]
-supportedMarkers(::PlottingPackage) = [:none]
-supportedScales(::PlottingPackage) = [:identity]
-subplotSupported(::PlottingPackage) = false
-stringsSupported(::PlottingPackage) = false
+supportedAxes(::AbstractBackend) = [:left]
+supportedTypes(::AbstractBackend) = []
+supportedStyles(::AbstractBackend) = [:solid]
+supportedMarkers(::AbstractBackend) = [:none]
+supportedScales(::AbstractBackend) = [:identity]
+subplotSupported(::AbstractBackend) = false
+stringsSupported(::AbstractBackend) = false
supportedAxes() = supportedAxes(backend())
supportedTypes() = supportedTypes(backend())
@@ -19,7 +19,7 @@ stringsSupported() = stringsSupported(backend())
# --------------------------------------------------------------------------------------
-supportedArgs(::GadflyPackage) = [
+supportedArgs(::GadflyBackend) = [
:annotation,
# :axis,
:background_color,
@@ -78,32 +78,32 @@ supportedArgs(::GadflyPackage) = [
# :surface,
:levels,
]
-supportedAxes(::GadflyPackage) = [:auto, :left]
-supportedTypes(::GadflyPackage) = [:none, :line, :path, :steppre, :steppost, :sticks,
+supportedAxes(::GadflyBackend) = [:auto, :left]
+supportedTypes(::GadflyBackend) = [:none, :line, :path, :steppre, :steppost, :sticks,
:scatter, :hist2d, :hexbin, :hist, :bar,
:hline, :vline, :contour]
-supportedStyles(::GadflyPackage) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
-supportedMarkers(::GadflyPackage) = vcat(_allMarkers, Shape)
-supportedScales(::GadflyPackage) = [:identity, :ln, :log2, :log10, :asinh, :sqrt]
-subplotSupported(::GadflyPackage) = true
+supportedStyles(::GadflyBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
+supportedMarkers(::GadflyBackend) = vcat(_allMarkers, Shape)
+supportedScales(::GadflyBackend) = [:identity, :ln, :log2, :log10, :asinh, :sqrt]
+subplotSupported(::GadflyBackend) = true
# --------------------------------------------------------------------------------------
-supportedArgs(::ImmersePackage) = supportedArgs(GadflyPackage())
-supportedAxes(::ImmersePackage) = supportedAxes(GadflyPackage())
-supportedTypes(::ImmersePackage) = supportedTypes(GadflyPackage())
-supportedStyles(::ImmersePackage) = supportedStyles(GadflyPackage())
-supportedMarkers(::ImmersePackage) = supportedMarkers(GadflyPackage())
-supportedScales(::ImmersePackage) = supportedScales(GadflyPackage())
-subplotSupported(::ImmersePackage) = true
+supportedArgs(::ImmerseBackend) = supportedArgs(GadflyBackend())
+supportedAxes(::ImmerseBackend) = supportedAxes(GadflyBackend())
+supportedTypes(::ImmerseBackend) = supportedTypes(GadflyBackend())
+supportedStyles(::ImmerseBackend) = supportedStyles(GadflyBackend())
+supportedMarkers(::ImmerseBackend) = supportedMarkers(GadflyBackend())
+supportedScales(::ImmerseBackend) = supportedScales(GadflyBackend())
+subplotSupported(::ImmerseBackend) = true
# --------------------------------------------------------------------------------------
-supportedArgs(::PyPlotPackage) = [
+supportedArgs(::PyPlotBackend) = [
:annotation,
:axis,
:background_color,
@@ -164,22 +164,22 @@ supportedArgs(::PyPlotPackage) = [
:markeralpha,
:overwrite_figure,
]
-supportedAxes(::PyPlotPackage) = _allAxes
-supportedTypes(::PyPlotPackage) = [:none, :line, :path, :steppre, :steppost, #:sticks,
+supportedAxes(::PyPlotBackend) = _allAxes
+supportedTypes(::PyPlotBackend) = [:none, :line, :path, :steppre, :steppost, #:sticks,
:scatter, :hist2d, :hexbin, :hist, :density, :bar,
:hline, :vline, :contour, :path3d, :scatter3d, :surface, :wireframe, :heatmap]
-supportedStyles(::PyPlotPackage) = [:auto, :solid, :dash, :dot, :dashdot]
-# supportedMarkers(::PyPlotPackage) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :hexagon]
-supportedMarkers(::PyPlotPackage) = vcat(_allMarkers, Shape)
-supportedScales(::PyPlotPackage) = [:identity, :ln, :log2, :log10]
-subplotSupported(::PyPlotPackage) = true
+supportedStyles(::PyPlotBackend) = [:auto, :solid, :dash, :dot, :dashdot]
+# supportedMarkers(::PyPlotBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :hexagon]
+supportedMarkers(::PyPlotBackend) = vcat(_allMarkers, Shape)
+supportedScales(::PyPlotBackend) = [:identity, :ln, :log2, :log10]
+subplotSupported(::PyPlotBackend) = true
# --------------------------------------------------------------------------------------
-supportedArgs(::GRPackage) = [
+supportedArgs(::GRBackend) = [
:annotation,
:axis,
:background_color,
@@ -238,22 +238,22 @@ supportedArgs(::GRPackage) = [
:linealpha,
:markeralpha,
]
-supportedAxes(::GRPackage) = _allAxes
-supportedTypes(::GRPackage) = [:none, :line, :path, :steppre, :steppost, :sticks,
+supportedAxes(::GRBackend) = _allAxes
+supportedTypes(::GRBackend) = [:none, :line, :path, :steppre, :steppost, :sticks,
:scatter, :hist2d, :hexbin, :hist, :density, :bar,
:hline, :vline, :contour, :path3d, :scatter3d, :surface,
:wireframe, :ohlc, :pie]
-supportedStyles(::GRPackage) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
-supportedMarkers(::GRPackage) = vcat(_allMarkers, Shape)
-supportedScales(::GRPackage) = [:identity, :log10]
-subplotSupported(::GRPackage) = true
+supportedStyles(::GRBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
+supportedMarkers(::GRBackend) = vcat(_allMarkers, Shape)
+supportedScales(::GRBackend) = [:identity, :log10]
+subplotSupported(::GRBackend) = true
# --------------------------------------------------------------------------------------
-supportedArgs(::QwtPackage) = [
+supportedArgs(::QwtBackend) = [
:annotation,
# :args,
:axis,
@@ -304,16 +304,16 @@ supportedArgs(::QwtPackage) = [
# :yflip,
# :z,
]
-supportedTypes(::QwtPackage) = [:none, :line, :path, :steppre, :steppost, :sticks, :scatter, :hist2d, :hexbin, :hist, :bar, :hline, :vline]
-supportedMarkers(::QwtPackage) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :star8, :hexagon]
-supportedScales(::QwtPackage) = [:identity, :log10]
-subplotSupported(::QwtPackage) = true
+supportedTypes(::QwtBackend) = [:none, :line, :path, :steppre, :steppost, :sticks, :scatter, :hist2d, :hexbin, :hist, :bar, :hline, :vline]
+supportedMarkers(::QwtBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5, :star8, :hexagon]
+supportedScales(::QwtBackend) = [:identity, :log10]
+subplotSupported(::QwtBackend) = true
# --------------------------------------------------------------------------------------
-supportedArgs(::UnicodePlotsPackage) = [
+supportedArgs(::UnicodePlotsBackend) = [
# :annotation,
# :args,
# :axis,
@@ -362,12 +362,12 @@ supportedArgs(::UnicodePlotsPackage) = [
# :yflip,
# :z,
]
-supportedAxes(::UnicodePlotsPackage) = [:auto, :left]
-supportedTypes(::UnicodePlotsPackage) = [:none, :line, :path, :steppre, :steppost, :sticks, :scatter, :hist2d, :hexbin, :hist, :bar, :hline, :vline]
-supportedStyles(::UnicodePlotsPackage) = [:auto, :solid]
-supportedMarkers(::UnicodePlotsPackage) = [:none, :auto, :ellipse]
-supportedScales(::UnicodePlotsPackage) = [:identity]
-subplotSupported(::UnicodePlotsPackage) = true
+supportedAxes(::UnicodePlotsBackend) = [:auto, :left]
+supportedTypes(::UnicodePlotsBackend) = [:none, :line, :path, :steppre, :steppost, :sticks, :scatter, :hist2d, :hexbin, :hist, :bar, :hline, :vline]
+supportedStyles(::UnicodePlotsBackend) = [:auto, :solid]
+supportedMarkers(::UnicodePlotsBackend) = [:none, :auto, :ellipse]
+supportedScales(::UnicodePlotsBackend) = [:identity]
+subplotSupported(::UnicodePlotsBackend) = true
@@ -375,7 +375,7 @@ subplotSupported(::UnicodePlotsPackage) = true
# --------------------------------------------------------------------------------------
-supportedArgs(::WinstonPackage) = [
+supportedArgs(::WinstonBackend) = [
:annotation,
# :args,
# :axis,
@@ -426,19 +426,19 @@ supportedArgs(::WinstonPackage) = [
# :yflip,
# :z,
]
-supportedAxes(::WinstonPackage) = [:auto, :left]
-supportedTypes(::WinstonPackage) = [:none, :line, :path, :sticks, :scatter, :hist, :bar]
-supportedStyles(::WinstonPackage) = [:auto, :solid, :dash, :dot, :dashdot]
-supportedMarkers(::WinstonPackage) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5]
-supportedScales(::WinstonPackage) = [:identity, :log10]
-subplotSupported(::WinstonPackage) = false
+supportedAxes(::WinstonBackend) = [:auto, :left]
+supportedTypes(::WinstonBackend) = [:none, :line, :path, :sticks, :scatter, :hist, :bar]
+supportedStyles(::WinstonBackend) = [:auto, :solid, :dash, :dot, :dashdot]
+supportedMarkers(::WinstonBackend) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5]
+supportedScales(::WinstonBackend) = [:identity, :log10]
+subplotSupported(::WinstonBackend) = false
# --------------------------------------------------------------------------------------
-supportedArgs(::BokehPackage) = [
+supportedArgs(::BokehBackend) = [
# :annotation,
# :axis,
# :background_color,
@@ -494,17 +494,17 @@ supportedArgs(::BokehPackage) = [
# :surface,
# :levels,
]
-supportedAxes(::BokehPackage) = [:auto, :left]
-supportedTypes(::BokehPackage) = [:none, :path, :scatter] #,:steppre, :steppost, :sticks, :hist2d, :hexbin, :hist, :bar, :hline, :vline, :contour]
-supportedStyles(::BokehPackage) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
-supportedMarkers(::BokehPackage) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
-supportedScales(::BokehPackage) = [:identity, :ln] #, :ln, :log2, :log10, :asinh, :sqrt]
-subplotSupported(::BokehPackage) = false
+supportedAxes(::BokehBackend) = [:auto, :left]
+supportedTypes(::BokehBackend) = [:none, :path, :scatter] #,:steppre, :steppost, :sticks, :hist2d, :hexbin, :hist, :bar, :hline, :vline, :contour]
+supportedStyles(::BokehBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
+supportedMarkers(::BokehBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
+supportedScales(::BokehBackend) = [:identity, :ln] #, :ln, :log2, :log10, :asinh, :sqrt]
+subplotSupported(::BokehBackend) = false
# --------------------------------------------------------------------------------------
-supportedArgs(::PlotlyPackage) = [
+supportedArgs(::PlotlyBackend) = [
:annotation,
# :axis,
:background_color,
@@ -560,21 +560,21 @@ supportedArgs(::PlotlyPackage) = [
:grid,
:levels,
]
-supportedAxes(::PlotlyPackage) = [:auto, :left]
-supportedTypes(::PlotlyPackage) = [:none, :line, :path, :scatter, :steppre, :steppost,
+supportedAxes(::PlotlyBackend) = [:auto, :left]
+supportedTypes(::PlotlyBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
:hist2d, :hist, :density, :bar, :contour, :surface, :path3d, :scatter3d,
:pie, :heatmap] #,, :sticks, :hexbin, :hline, :vline]
-supportedStyles(::PlotlyPackage) = [:auto, :solid, :dash, :dot, :dashdot]
-supportedMarkers(::PlotlyPackage) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
+supportedStyles(::PlotlyBackend) = [:auto, :solid, :dash, :dot, :dashdot]
+supportedMarkers(::PlotlyBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
:pentagon, :hexagon, :octagon, :vline, :hline] #vcat(_allMarkers, Shape)
-supportedScales(::PlotlyPackage) = [:identity, :log10] #, :ln, :log2, :log10, :asinh, :sqrt]
-subplotSupported(::PlotlyPackage) = true
-stringsSupported(::PlotlyPackage) = true
+supportedScales(::PlotlyBackend) = [:identity, :log10] #, :ln, :log2, :log10, :asinh, :sqrt]
+subplotSupported(::PlotlyBackend) = true
+stringsSupported(::PlotlyBackend) = true
# --------------------------------------------------------------------------------------
-supportedArgs(::PlotlyJSPackage) = [
+supportedArgs(::PlotlyJSBackend) = [
:annotation,
# :axis,
:background_color,
@@ -630,20 +630,20 @@ supportedArgs(::PlotlyJSPackage) = [
:grid,
:levels,
]
-supportedAxes(::PlotlyJSPackage) = [:auto, :left]
-supportedTypes(::PlotlyJSPackage) = [:none, :line, :path, :scatter, :steppre, :steppost,
+supportedAxes(::PlotlyJSBackend) = [:auto, :left]
+supportedTypes(::PlotlyJSBackend) = [:none, :line, :path, :scatter, :steppre, :steppost,
:hist2d, :hist, :density, :bar, :contour, :surface, :path3d, :scatter3d,
:pie, :heatmap] #,, :sticks, :hexbin, :hline, :vline]
-supportedStyles(::PlotlyJSPackage) = [:auto, :solid, :dash, :dot, :dashdot]
-supportedMarkers(::PlotlyJSPackage) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
+supportedStyles(::PlotlyJSBackend) = [:auto, :solid, :dash, :dot, :dashdot]
+supportedMarkers(::PlotlyJSBackend) = [:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross,
:pentagon, :hexagon, :octagon, :vline, :hline] #vcat(_allMarkers, Shape)
-supportedScales(::PlotlyJSPackage) = [:identity, :log10] #, :ln, :log2, :log10, :asinh, :sqrt]
-subplotSupported(::PlotlyJSPackage) = true
-stringsSupported(::PlotlyJSPackage) = true
+supportedScales(::PlotlyJSBackend) = [:identity, :log10] #, :ln, :log2, :log10, :asinh, :sqrt]
+subplotSupported(::PlotlyJSBackend) = true
+stringsSupported(::PlotlyJSBackend) = true
# --------------------------------------------------------------------------------------
-supportedArgs(::GLVisualizePackage) = [
+supportedArgs(::GLVisualizeBackend) = [
# :annotation,
# :axis,
# :background_color,
@@ -699,16 +699,16 @@ supportedArgs(::GLVisualizePackage) = [
# :surface
# :levels,
]
-supportedAxes(::GLVisualizePackage) = [:auto, :left]
-supportedTypes(::GLVisualizePackage) = [:surface] #, :path, :scatter ,:steppre, :steppost, :sticks, :heatmap, :hexbin, :hist, :bar, :hline, :vline, :contour]
-supportedStyles(::GLVisualizePackage) = [:auto, :solid] #, :dash, :dot, :dashdot, :dashdotdot]
-supportedMarkers(::GLVisualizePackage) = [:none, :auto, :ellipse] #, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
-supportedScales(::GLVisualizePackage) = [:identity] #, :log, :log2, :log10, :asinh, :sqrt]
-subplotSupported(::GLVisualizePackage) = false
+supportedAxes(::GLVisualizeBackend) = [:auto, :left]
+supportedTypes(::GLVisualizeBackend) = [:surface] #, :path, :scatter ,:steppre, :steppost, :sticks, :heatmap, :hexbin, :hist, :bar, :hline, :vline, :contour]
+supportedStyles(::GLVisualizeBackend) = [:auto, :solid] #, :dash, :dot, :dashdot, :dashdotdot]
+supportedMarkers(::GLVisualizeBackend) = [:none, :auto, :ellipse] #, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
+supportedScales(::GLVisualizeBackend) = [:identity] #, :log, :log2, :log10, :asinh, :sqrt]
+subplotSupported(::GLVisualizeBackend) = false
# --------------------------------------------------------------------------------------
-supportedArgs(::PGFPlotsPackage) = [
+supportedArgs(::PGFPlotsBackend) = [
# :annotation,
# :axis,
# :background_color,
@@ -764,10 +764,10 @@ supportedArgs(::PGFPlotsPackage) = [
# :surface
# :levels,
]
-supportedAxes(::PGFPlotsPackage) = [:auto, :left]
-supportedTypes(::PGFPlotsPackage) = [:contour] #, :path, :scatter ,:steppre, :steppost, :sticks, :hist2d, :hexbin, :hist, :bar, :hline, :vline, :contour]
-supportedStyles(::PGFPlotsPackage) = [:auto, :solid] #, :dash, :dot, :dashdot, :dashdotdot]
-supportedMarkers(::PGFPlotsPackage) = [:none, :auto, :ellipse] #, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
-supportedScales(::PGFPlotsPackage) = [:identity] #, :log, :log2, :log10, :asinh, :sqrt]
-subplotSupported(::PGFPlotsPackage) = false
+supportedAxes(::PGFPlotsBackend) = [:auto, :left]
+supportedTypes(::PGFPlotsBackend) = [:contour] #, :path, :scatter ,:steppre, :steppost, :sticks, :hist2d, :hexbin, :hist, :bar, :hline, :vline, :contour]
+supportedStyles(::PGFPlotsBackend) = [:auto, :solid] #, :dash, :dot, :dashdot, :dashdotdot]
+supportedMarkers(::PGFPlotsBackend) = [:none, :auto, :ellipse] #, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
+supportedScales(::PGFPlotsBackend) = [:identity] #, :log, :log2, :log10, :asinh, :sqrt]
+subplotSupported(::PGFPlotsBackend) = false
diff --git a/src/backends/template.jl b/src/backends/template.jl
index b8148da0..d82bcbd1 100644
--- a/src/backends/template.jl
+++ b/src/backends/template.jl
@@ -3,7 +3,7 @@
# [WEBSITE]
-function _initialize_backend(::[PkgName]Package; kw...)
+function _initialize_backend(::[PkgName]AbstractBackend; kw...)
@eval begin
import [PkgName]
export [PkgName]
@@ -14,7 +14,7 @@ end
# ---------------------------------------------------------------------------
-function _create_plot(pkg::[PkgName]Package; kw...)
+function _create_plot(pkg::[PkgName]AbstractBackend; kw...)
d = Dict(kw)
# TODO: create the window/canvas/context that is the plot within the backend (call it `o`)
# TODO: initialize the plot... title, xlabel, bgcolor, etc
@@ -22,14 +22,14 @@ function _create_plot(pkg::[PkgName]Package; kw...)
end
-function _add_series(::[PkgName]Package, plt::Plot; kw...)
+function _add_series(::[PkgName]AbstractBackend, plt::Plot; kw...)
d = Dict(kw)
# TODO: add one series to the underlying package
push!(plt.seriesargs, d)
plt
end
-function _add_annotations{X,Y,V}(plt::Plot{[PkgName]Package}, anns::AVec{@compat(Tuple{X,Y,V})})
+function _add_annotations{X,Y,V}(plt::Plot{[PkgName]AbstractBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
for ann in anns
# TODO: add the annotation to the plot
end
@@ -37,53 +37,53 @@ end
# ----------------------------------------------------------------
-function _before_update_plot(plt::Plot{[PkgName]Package})
+function _before_update_plot(plt::Plot{[PkgName]AbstractBackend})
end
# TODO: override this to update plot items (title, xlabel, etc) after creation
-function _update_plot(plt::Plot{[PkgName]Package}, d::Dict)
+function _update_plot(plt::Plot{[PkgName]AbstractBackend}, d::Dict)
end
-function _update_plot_pos_size(plt::PlottingObject{[PkgName]Package}, d::Dict)
+function _update_plot_pos_size(plt::AbstractPlot{[PkgName]AbstractBackend}, d::Dict)
end
# ----------------------------------------------------------------
# accessors for x/y data
-function Base.getindex(plt::Plot{[PkgName]Package}, i::Int)
+function Base.getindex(plt::Plot{[PkgName]AbstractBackend}, i::Int)
# TODO: return a tuple of (x, y) vectors
end
-function Base.setindex!(plt::Plot{[PkgName]Package}, xy::Tuple, i::Integer)
+function Base.setindex!(plt::Plot{[PkgName]AbstractBackend}, xy::Tuple, i::Integer)
# TODO: set the plot data from the (x,y) tuple
plt
end
# ----------------------------------------------------------------
-function _create_subplot(subplt::Subplot{[PkgName]Package}, isbefore::Bool)
+function _create_subplot(subplt::Subplot{[PkgName]AbstractBackend}, isbefore::Bool)
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example
end
-function _expand_limits(lims, plt::Plot{[PkgName]Package}, isx::Bool)
+function _expand_limits(lims, plt::Plot{[PkgName]AbstractBackend}, isx::Bool)
# TODO: call expand limits for each plot data
end
-function _remove_axis(plt::Plot{[PkgName]Package}, isx::Bool)
+function _remove_axis(plt::Plot{[PkgName]AbstractBackend}, isx::Bool)
# TODO: if plot is inner subplot, might need to remove ticks or axis labels
end
# ----------------------------------------------------------------
-function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{[PkgName]Package})
+function Base.writemime(io::IO, ::MIME"image/png", plt::AbstractPlot{[PkgName]AbstractBackend})
# TODO: write a png to io
end
-function Base.display(::PlotsDisplay, plt::Plot{[PkgName]Package})
+function Base.display(::PlotsDisplay, plt::Plot{[PkgName]AbstractBackend})
# TODO: display/show the plot
end
-function Base.display(::PlotsDisplay, plt::Subplot{[PkgName]Package})
+function Base.display(::PlotsDisplay, plt::Subplot{[PkgName]AbstractBackend})
# TODO: display/show the subplot
end
diff --git a/src/backends/unicodeplots.jl b/src/backends/unicodeplots.jl
index b2da0c11..38fd348e 100644
--- a/src/backends/unicodeplots.jl
+++ b/src/backends/unicodeplots.jl
@@ -1,7 +1,7 @@
# https://github.com/Evizero/UnicodePlots.jl
-function _initialize_backend(::UnicodePlotsPackage; kw...)
+function _initialize_backend(::UnicodePlotsBackend; kw...)
@eval begin
import UnicodePlots
export UnicodePlots
@@ -111,7 +111,7 @@ function addUnicodeSeries!(o, d::Dict, addlegend::Bool, xlim, ylim)
end
-function handlePlotColors(::UnicodePlotsPackage, d::Dict)
+function handlePlotColors(::UnicodePlotsBackend, d::Dict)
# TODO: something special for unicodeplots, since it doesn't take kindly to people messing with its color palette
d[:color_palette] = [RGB(0,0,0)]
end
@@ -119,7 +119,7 @@ end
# -------------------------------
-function _create_plot(pkg::UnicodePlotsPackage; kw...)
+function _create_plot(pkg::UnicodePlotsBackend; kw...)
plt = Plot(nothing, pkg, 0, Dict(kw), Dict[])
# do we want to give a new default size?
@@ -130,7 +130,7 @@ function _create_plot(pkg::UnicodePlotsPackage; kw...)
plt
end
-function _add_series(::UnicodePlotsPackage, plt::Plot; kw...)
+function _add_series(::UnicodePlotsBackend, plt::Plot; kw...)
d = Dict(kw)
if d[:linetype] in (:sticks, :bar)
d = barHack(; d...)
@@ -142,7 +142,7 @@ function _add_series(::UnicodePlotsPackage, plt::Plot; kw...)
end
-function _update_plot(plt::Plot{UnicodePlotsPackage}, d::Dict)
+function _update_plot(plt::Plot{UnicodePlotsBackend}, d::Dict)
for k in (:title, :xlabel, :ylabel, :xlims, :ylims)
if haskey(d, k)
plt.plotargs[k] = d[k]
@@ -154,7 +154,7 @@ end
# -------------------------------
# since this is such a hack, it's only callable using `png`... should error during normal `writemime`
-function png(plt::PlottingObject{UnicodePlotsPackage}, fn::@compat(AbstractString))
+function png(plt::AbstractPlot{UnicodePlotsBackend}, fn::@compat(AbstractString))
fn = addExtension(fn, "png")
# make some whitespace and show the plot
@@ -182,20 +182,20 @@ end
# we don't do very much for subplots... just stack them vertically
-function _create_subplot(subplt::Subplot{UnicodePlotsPackage}, isbefore::Bool)
+function _create_subplot(subplt::Subplot{UnicodePlotsBackend}, isbefore::Bool)
isbefore && return false
true
end
-function Base.display(::PlotsDisplay, plt::Plot{UnicodePlotsPackage})
+function Base.display(::PlotsDisplay, plt::Plot{UnicodePlotsBackend})
rebuildUnicodePlot!(plt)
show(plt.o)
end
-function Base.display(::PlotsDisplay, subplt::Subplot{UnicodePlotsPackage})
+function Base.display(::PlotsDisplay, subplt::Subplot{UnicodePlotsBackend})
for plt in subplt.plts
gui(plt)
end
diff --git a/src/backends/web.jl b/src/backends/web.jl
index f0a39f93..1be80c11 100644
--- a/src/backends/web.jl
+++ b/src/backends/web.jl
@@ -4,7 +4,7 @@
# CREDIT: parts of this implementation were inspired by @joshday's PlotlyLocal.jl
-function standalone_html(plt::PlottingObject; title::AbstractString = get(plt.plotargs, :window_title, "Plots.jl"))
+function standalone_html(plt::AbstractPlot; title::AbstractString = get(plt.plotargs, :window_title, "Plots.jl"))
"""
@@ -26,7 +26,7 @@ function open_browser_window(filename::AbstractString)
warn("Unknown OS... cannot open browser window.")
end
-function standalone_html_window(plt::PlottingObject; kw...)
+function standalone_html_window(plt::AbstractPlot; kw...)
html = standalone_html(plt; kw...)
# println(html)
filename = string(tempname(), ".html")
diff --git a/src/backends/winston.jl b/src/backends/winston.jl
index f836c6b8..687a0ddd 100644
--- a/src/backends/winston.jl
+++ b/src/backends/winston.jl
@@ -3,7 +3,7 @@
# credit goes to https://github.com/jverzani for contributing to the first draft of this backend implementation
-function _initialize_backend(::WinstonPackage; kw...)
+function _initialize_backend(::WinstonBackend; kw...)
@eval begin
# ENV["WINSTON_OUTPUT"] = "gtk"
warn("Winston is no longer supported... many features will likely be broken.")
@@ -33,14 +33,14 @@ end
:star5 => "asterisk"
)
-function _before_add_series(plt::Plot{WinstonPackage})
+function _before_add_series(plt::Plot{WinstonBackend})
Winston.ghf(plt.o)
end
# ---------------------------------------------------------------------------
-function _create_plot(pkg::WinstonPackage; kw...)
+function _create_plot(pkg::WinstonBackend; kw...)
d = Dict(kw)
wplt = Winston.FramedPlot(title = d[:title], xlabel = d[:xlabel], ylabel = d[:ylabel])
@@ -64,7 +64,7 @@ function getWinstonItems(plt::Plot)
window, canvas, wplt
end
-function _add_series(::WinstonPackage, plt::Plot; kw...)
+function _add_series(::WinstonBackend, plt::Plot; kw...)
d = Dict(kw)
window, canvas, wplt = getWinstonItems(plt)
@@ -165,7 +165,7 @@ end
:yscale => :ylog,
)
-function _update_plot(plt::Plot{WinstonPackage}, d::Dict)
+function _update_plot(plt::Plot{WinstonBackend}, d::Dict)
window, canvas, wplt = getWinstonItems(plt)
for k in (:xlabel, :ylabel, :title, :xlims, :ylims)
if haskey(d, k)
@@ -186,11 +186,11 @@ end
# ----------------------------------------------------------------
-function createWinstonAnnotationObject(plt::Plot{WinstonPackage}, x, y, val::@compat(AbstractString))
+function createWinstonAnnotationObject(plt::Plot{WinstonBackend}, x, y, val::@compat(AbstractString))
Winston.text(x, y, val)
end
-function _add_annotations{X,Y,V}(plt::Plot{WinstonPackage}, anns::AVec{@compat(Tuple{X,Y,V})})
+function _add_annotations{X,Y,V}(plt::Plot{WinstonBackend}, anns::AVec{@compat(Tuple{X,Y,V})})
for ann in anns
createWinstonAnnotationObject(plt, ann...)
end
@@ -199,7 +199,7 @@ end
# ----------------------------------------------------------------
-function _create_subplot(subplt::Subplot{WinstonPackage}, isbefore::Bool)
+function _create_subplot(subplt::Subplot{WinstonBackend}, isbefore::Bool)
# TODO: build the underlying Subplot object. this is where you might layout the panes within a GUI window, for example
end
@@ -211,14 +211,14 @@ function addWinstonLegend(plt::Plot, wplt)
end
end
-function Base.writemime(io::IO, ::MIME"image/png", plt::PlottingObject{WinstonPackage})
+function Base.writemime(io::IO, ::MIME"image/png", plt::AbstractPlot{WinstonBackend})
window, canvas, wplt = getWinstonItems(plt)
addWinstonLegend(plt, wplt)
writemime(io, "image/png", wplt)
end
-function Base.display(::PlotsDisplay, plt::Plot{WinstonPackage})
+function Base.display(::PlotsDisplay, plt::Plot{WinstonBackend})
window, canvas, wplt = getWinstonItems(plt)
@@ -240,6 +240,6 @@ function Base.display(::PlotsDisplay, plt::Plot{WinstonPackage})
end
-function Base.display(::PlotsDisplay, subplt::Subplot{WinstonPackage})
+function Base.display(::PlotsDisplay, subplt::Subplot{WinstonBackend})
# TODO: display/show the Subplot object
end
diff --git a/src/colors.jl b/src/colors.jl
index 2028ebfb..3a1f6ef1 100644
--- a/src/colors.jl
+++ b/src/colors.jl
@@ -354,7 +354,7 @@ webcolor(c, α) = webcolor(convertColor(getColor(c), α))
# TODO: allow the setting of the algorithm, either by passing a symbol (:colordiff, :fixed, etc) or a function?
# function getBackgroundRGBColor(c, d::Dict)
-function handlePlotColors(::PlottingPackage, d::Dict)
+function handlePlotColors(::AbstractBackend, d::Dict)
if :background_color in supportedArgs()
bgcolor = convertColor(d[:background_color])
else
diff --git a/src/output.jl b/src/output.jl
index ad8bb9f3..95a7bf08 100644
--- a/src/output.jl
+++ b/src/output.jl
@@ -1,8 +1,8 @@
-defaultOutputFormat(plt::PlottingObject) = "png"
+defaultOutputFormat(plt::AbstractPlot) = "png"
-function png(plt::PlottingObject, fn::@compat(AbstractString))
+function png(plt::AbstractPlot, fn::@compat(AbstractString))
fn = addExtension(fn, "png")
io = open(fn, "w")
writemime(io, MIME("image/png"), plt)
@@ -10,7 +10,7 @@ function png(plt::PlottingObject, fn::@compat(AbstractString))
end
png(fn::@compat(AbstractString)) = png(current(), fn)
-function svg(plt::PlottingObject, fn::@compat(AbstractString))
+function svg(plt::AbstractPlot, fn::@compat(AbstractString))
fn = addExtension(fn, "svg")
io = open(fn, "w")
writemime(io, MIME("image/svg+xml"), plt)
@@ -19,7 +19,7 @@ end
svg(fn::@compat(AbstractString)) = svg(current(), fn)
-function pdf(plt::PlottingObject, fn::@compat(AbstractString))
+function pdf(plt::AbstractPlot, fn::@compat(AbstractString))
fn = addExtension(fn, "pdf")
io = open(fn, "w")
writemime(io, MIME("application/pdf"), plt)
@@ -28,7 +28,7 @@ end
pdf(fn::@compat(AbstractString)) = pdf(current(), fn)
-function ps(plt::PlottingObject, fn::@compat(AbstractString))
+function ps(plt::AbstractPlot, fn::@compat(AbstractString))
fn = addExtension(fn, "ps")
io = open(fn, "w")
writemime(io, MIME("application/postscript"), plt)
@@ -37,7 +37,7 @@ end
ps(fn::@compat(AbstractString)) = ps(current(), fn)
-function tex(plt::PlottingObject, fn::@compat(AbstractString))
+function tex(plt::AbstractPlot, fn::@compat(AbstractString))
fn = addExtension(fn, "tex")
io = open(fn, "w")
writemime(io, MIME("application/x-tex"), plt)
@@ -78,7 +78,7 @@ function addExtension(fn::@compat(AbstractString), ext::@compat(AbstractString))
end
end
-function savefig(plt::PlottingObject, fn::@compat(AbstractString))
+function savefig(plt::AbstractPlot, fn::@compat(AbstractString))
# get the extension
local ext
@@ -100,20 +100,20 @@ savefig(fn::@compat(AbstractString)) = savefig(current(), fn)
# savepng(args...; kw...) = savepng(current(), args...; kw...)
-# savepng(plt::PlottingObject, fn::@compat(AbstractString); kw...) = (io = open(fn, "w"); writemime(io, MIME("image/png"), plt); close(io))
+# savepng(plt::AbstractPlot, fn::@compat(AbstractString); kw...) = (io = open(fn, "w"); writemime(io, MIME("image/png"), plt); close(io))
# ---------------------------------------------------------
-gui(plt::PlottingObject = current()) = display(PlotsDisplay(), plt)
+gui(plt::AbstractPlot = current()) = display(PlotsDisplay(), plt)
# override the REPL display to open a gui window
-Base.display(::Base.REPL.REPLDisplay, ::MIME"text/plain", plt::PlottingObject) = gui(plt)
+Base.display(::Base.REPL.REPLDisplay, ::MIME"text/plain", plt::AbstractPlot) = gui(plt)
# a backup for html... passes to svg
-function Base.writemime(io::IO, ::MIME"text/html", plt::PlottingObject)
+function Base.writemime(io::IO, ::MIME"text/html", plt::AbstractPlot)
writemime(io, MIME("image/svg+xml"), plt)
end
diff --git a/src/plot.jl b/src/plot.jl
index ef8d5da8..3fa72394 100644
--- a/src/plot.jl
+++ b/src/plot.jl
@@ -1,8 +1,8 @@
type CurrentPlot
- nullableplot::Nullable{PlottingObject}
+ nullableplot::Nullable{AbstractPlot}
end
-const CURRENT_PLOT = CurrentPlot(Nullable{PlottingObject}())
+const CURRENT_PLOT = CurrentPlot(Nullable{AbstractPlot}())
isplotnull() = isnull(CURRENT_PLOT.nullableplot)
@@ -12,7 +12,7 @@ function current()
end
get(CURRENT_PLOT.nullableplot)
end
-current(plot::PlottingObject) = (CURRENT_PLOT.nullableplot = Nullable(plot))
+current(plot::AbstractPlot) = (CURRENT_PLOT.nullableplot = Nullable(plot))
# ---------------------------------------------------------
@@ -69,11 +69,6 @@ function plot!(args...; kw...)
plot!(current(), args...; kw...)
end
-# not allowed:
-function plot!(subplt::Subplot, args...; kw...)
- error("Can't call plot! on a Subplot!")
-end
-
# this adds to a specific plot... most plot commands will flow through here
function plot!(plt::Plot, args...; kw...)
d = Dict(kw)
@@ -246,7 +241,7 @@ convertToAnyVector{T<:@compat(AbstractString)}(v::AVec{T}, d::Dict) = Any[v], no
function convertToAnyVector{T<:Real}(v::AMat{T}, d::Dict)
if all3D(d)
Any[Surface(v)]
- else
+ else
Any[v[:,i] for i in 1:size(v,2)]
end, nothing
end
@@ -298,7 +293,7 @@ end
# create n=max(mx,my) series arguments. the shorter list is cycled through
# note: everything should flow through this
-function createKWargsList(plt::PlottingObject, x, y; kw...)
+function createKWargsList(plt::AbstractPlot, x, y; kw...)
kwdict = Dict(kw)
xs, xmeta = convertToAnyVector(x, kwdict)
ys, ymeta = convertToAnyVector(y, kwdict)
@@ -370,7 +365,7 @@ function createKWargsList(plt::PlottingObject, x, y; kw...)
end
# handle grouping
-function createKWargsList(plt::PlottingObject, groupby::GroupBy, args...; kw...)
+function createKWargsList(plt::AbstractPlot, groupby::GroupBy, args...; kw...)
ret = Any[]
for (i,glab) in enumerate(groupby.groupLabels)
# TODO: don't automatically overwrite labels
@@ -384,12 +379,12 @@ function createKWargsList(plt::PlottingObject, groupby::GroupBy, args...; kw...)
end
# pass it off to the x/y version
-function createKWargsList(plt::PlottingObject, y; kw...)
+function createKWargsList(plt::AbstractPlot, y; kw...)
createKWargsList(plt, nothing, y; kw...)
end
# 3d line or scatter
-function createKWargsList(plt::PlottingObject, x::AVec, y::AVec, zvec::AVec; kw...)
+function createKWargsList(plt::AbstractPlot, x::AVec, y::AVec, zvec::AVec; kw...)
d = Dict(kw)
if !(get(d, :linetype, :none) in _3dTypes)
d[:linetype] = :path3d
@@ -397,7 +392,7 @@ function createKWargsList(plt::PlottingObject, x::AVec, y::AVec, zvec::AVec; kw.
createKWargsList(plt, x, y; z=zvec, d...)
end
-function createKWargsList{T<:Real}(plt::PlottingObject, z::AMat{T}; kw...)
+function createKWargsList{T<:Real}(plt::AbstractPlot, z::AMat{T}; kw...)
d = Dict(kw)
if all3D(d)
n,m = size(z)
@@ -408,7 +403,7 @@ function createKWargsList{T<:Real}(plt::PlottingObject, z::AMat{T}; kw...)
end
# contours or surfaces... function grid
-function createKWargsList(plt::PlottingObject, x::AVec, y::AVec, zf::Function; kw...)
+function createKWargsList(plt::AbstractPlot, x::AVec, y::AVec, zf::Function; kw...)
# only allow sorted x/y for now
# TODO: auto sort x/y/z properly
@assert x == sort(x)
@@ -418,7 +413,7 @@ function createKWargsList(plt::PlottingObject, x::AVec, y::AVec, zf::Function; k
end
# contours or surfaces... matrix grid
-function createKWargsList{T<:Real}(plt::PlottingObject, x::AVec, y::AVec, zmat::AMat{T}; kw...)
+function createKWargsList{T<:Real}(plt::AbstractPlot, x::AVec, y::AVec, zmat::AMat{T}; kw...)
# only allow sorted x/y for now
# TODO: auto sort x/y/z properly
@assert x == sort(x)
@@ -436,7 +431,7 @@ function createKWargsList{T<:Real}(plt::PlottingObject, x::AVec, y::AVec, zmat::
end
# contours or surfaces... general x, y grid
-function createKWargsList{T<:Real}(plt::PlottingObject, x::AMat{T}, y::AMat{T}, zmat::AMat{T}; kw...)
+function createKWargsList{T<:Real}(plt::AbstractPlot, x::AMat{T}, y::AMat{T}, zmat::AMat{T}; kw...)
@assert size(zmat) == size(x) == size(y)
surf = Surface(convert(Matrix{Float64}, zmat))
# surf = Array(Any,1,1)
@@ -450,26 +445,26 @@ function createKWargsList{T<:Real}(plt::PlottingObject, x::AMat{T}, y::AMat{T},
end
-function createKWargsList(plt::PlottingObject, surf::Surface; kw...)
+function createKWargsList(plt::AbstractPlot, surf::Surface; kw...)
createKWargsList(plt, 1:size(surf.surf,1), 1:size(surf.surf,2), convert(Matrix{Float64}, surf.surf); kw...)
end
-function createKWargsList(plt::PlottingObject, x::AVec, y::AVec, surf::Surface; kw...)
+function createKWargsList(plt::AbstractPlot, x::AVec, y::AVec, surf::Surface; kw...)
createKWargsList(plt, x, y, convert(Matrix{Float64}, surf.surf); kw...)
end
-function createKWargsList(plt::PlottingObject, f::FuncOrFuncs; kw...)
+function createKWargsList(plt::AbstractPlot, f::FuncOrFuncs; kw...)
createKWargsList(plt, f, xmin(plt), xmax(plt); kw...)
end
# list of functions
-function createKWargsList(plt::PlottingObject, f::FuncOrFuncs, x; kw...)
+function createKWargsList(plt::AbstractPlot, f::FuncOrFuncs, x; kw...)
@assert !(typeof(x) <: FuncOrFuncs) # otherwise we'd hit infinite recursion here
createKWargsList(plt, x, f; kw...)
end
# special handling... xmin/xmax with function(s)
-function createKWargsList(plt::PlottingObject, f::FuncOrFuncs, xmin::Real, xmax::Real; kw...)
+function createKWargsList(plt::AbstractPlot, f::FuncOrFuncs, xmin::Real, xmax::Real; kw...)
width = get(plt.plotargs, :size, (100,))[1]
x = collect(linspace(xmin, xmax, width)) # we don't need more than the width
createKWargsList(plt, x, f; kw...)
@@ -479,27 +474,27 @@ mapFuncOrFuncs(f::Function, u::AVec) = map(f, u)
mapFuncOrFuncs(fs::AVec{Function}, u::AVec) = [map(f, u) for f in fs]
# special handling... xmin/xmax with parametric function(s)
-createKWargsList{T<:Real}(plt::PlottingObject, fx::FuncOrFuncs, fy::FuncOrFuncs, u::AVec{T}; kw...) = createKWargsList(plt, mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u); kw...)
-createKWargsList{T<:Real}(plt::PlottingObject, u::AVec{T}, fx::FuncOrFuncs, fy::FuncOrFuncs; kw...) = createKWargsList(plt, mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u); kw...)
-createKWargsList(plt::PlottingObject, fx::FuncOrFuncs, fy::FuncOrFuncs, umin::Real, umax::Real, numPoints::Int = 1000; kw...) = createKWargsList(plt, fx, fy, linspace(umin, umax, numPoints); kw...)
+createKWargsList{T<:Real}(plt::AbstractPlot, fx::FuncOrFuncs, fy::FuncOrFuncs, u::AVec{T}; kw...) = createKWargsList(plt, mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u); kw...)
+createKWargsList{T<:Real}(plt::AbstractPlot, u::AVec{T}, fx::FuncOrFuncs, fy::FuncOrFuncs; kw...) = createKWargsList(plt, mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u); kw...)
+createKWargsList(plt::AbstractPlot, fx::FuncOrFuncs, fy::FuncOrFuncs, umin::Real, umax::Real, numPoints::Int = 1000; kw...) = createKWargsList(plt, fx, fy, linspace(umin, umax, numPoints); kw...)
# special handling... 3D parametric function(s)
-createKWargsList{T<:Real}(plt::PlottingObject, fx::FuncOrFuncs, fy::FuncOrFuncs, fz::FuncOrFuncs, u::AVec{T}; kw...) = createKWargsList(plt, mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u), mapFuncOrFuncs(fz, u); kw...)
-createKWargsList{T<:Real}(plt::PlottingObject, u::AVec{T}, fx::FuncOrFuncs, fy::FuncOrFuncs, fz::FuncOrFuncs; kw...) = createKWargsList(plt, mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u), mapFuncOrFuncs(fz, u); kw...)
-createKWargsList(plt::PlottingObject, fx::FuncOrFuncs, fy::FuncOrFuncs, fz::FuncOrFuncs, umin::Real, umax::Real, numPoints::Int = 1000; kw...) = createKWargsList(plt, fx, fy, fz, linspace(umin, umax, numPoints); kw...)
+createKWargsList{T<:Real}(plt::AbstractPlot, fx::FuncOrFuncs, fy::FuncOrFuncs, fz::FuncOrFuncs, u::AVec{T}; kw...) = createKWargsList(plt, mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u), mapFuncOrFuncs(fz, u); kw...)
+createKWargsList{T<:Real}(plt::AbstractPlot, u::AVec{T}, fx::FuncOrFuncs, fy::FuncOrFuncs, fz::FuncOrFuncs; kw...) = createKWargsList(plt, mapFuncOrFuncs(fx, u), mapFuncOrFuncs(fy, u), mapFuncOrFuncs(fz, u); kw...)
+createKWargsList(plt::AbstractPlot, fx::FuncOrFuncs, fy::FuncOrFuncs, fz::FuncOrFuncs, umin::Real, umax::Real, numPoints::Int = 1000; kw...) = createKWargsList(plt, fx, fy, fz, linspace(umin, umax, numPoints); kw...)
# (x,y) tuples
-function createKWargsList{R1<:Real,R2<:Real}(plt::PlottingObject, xy::AVec{Tuple{R1,R2}}; kw...)
+function createKWargsList{R1<:Real,R2<:Real}(plt::AbstractPlot, xy::AVec{Tuple{R1,R2}}; kw...)
createKWargsList(plt, unzip(xy)...; kw...)
end
-function createKWargsList{R1<:Real,R2<:Real}(plt::PlottingObject, xy::Tuple{R1,R2}; kw...)
+function createKWargsList{R1<:Real,R2<:Real}(plt::AbstractPlot, xy::Tuple{R1,R2}; kw...)
createKWargsList(plt, [xy[1]], [xy[2]]; kw...)
end
# special handling... no args... 1 series
-function createKWargsList(plt::PlottingObject; kw...)
+function createKWargsList(plt::AbstractPlot; kw...)
d = Dict(kw)
if !haskey(d, :y)
# assume we just want to create an empty plot object which can be added to later
@@ -522,11 +517,11 @@ end
unzip{T}(x::AVec{FixedSizeArrays.Vec{2,T}}) = T[xi[1] for xi in x], T[xi[2] for xi in x]
unzip{T}(x::FixedSizeArrays.Vec{2,T}) = T[x[1]], T[x[2]]
- function createKWargsList{T<:Real}(plt::PlottingObject, xy::AVec{FixedSizeArrays.Vec{2,T}}; kw...)
+ function createKWargsList{T<:Real}(plt::AbstractPlot, xy::AVec{FixedSizeArrays.Vec{2,T}}; kw...)
createKWargsList(plt, unzip(xy)...; kw...)
end
- function createKWargsList{T<:Real}(plt::PlottingObject, xy::FixedSizeArrays.Vec{2,T}; kw...)
+ function createKWargsList{T<:Real}(plt::AbstractPlot, xy::FixedSizeArrays.Vec{2,T}; kw...)
createKWargsList(plt, [xy[1]], [xy[2]]; kw...)
end
@@ -538,7 +533,7 @@ end
@require DataFrames begin
- function createKWargsList(plt::PlottingObject, df::DataFrames.AbstractDataFrame, args...; kw...)
+ function createKWargsList(plt::AbstractPlot, df::DataFrames.AbstractDataFrame, args...; kw...)
createKWargsList(plt, args...; kw..., dataframe = df)
end
diff --git a/src/recipes.jl b/src/recipes.jl
index c133e813..639c2cf2 100644
--- a/src/recipes.jl
+++ b/src/recipes.jl
@@ -3,7 +3,7 @@
# TODO: there should be a distinction between an object that will manage a full plot, vs a component of a plot.
# the PlotRecipe as currently implemented is more of a "custom component"
# a recipe should fully describe the plotting command(s) and call them, likewise for updating.
-# actually... maybe those should explicitly derive from PlottingObject???
+# actually... maybe those should explicitly derive from AbstractPlot???
abstract PlotRecipe
diff --git a/src/subplot.jl b/src/subplot.jl
index 9b56bfbf..5bad03ac 100644
--- a/src/subplot.jl
+++ b/src/subplot.jl
@@ -127,7 +127,7 @@ function subplot{P,I<:Integer}(pltsPerRow::AVec{I}, plt1::Plot{P}, plts::Plot{P}
end
# this will be called internally
-function subplot{P<:PlottingPackage}(plts::AVec{Plot{P}}, layout::SubplotLayout, d::Dict)
+function subplot{P<:AbstractBackend}(plts::AVec{Plot{P}}, layout::SubplotLayout, d::Dict)
validateSubplotSupported()
p = length(layout)
n = sum([plt.n for plt in plts])
@@ -279,6 +279,11 @@ function subplot!(subplt::Subplot, args...; kw...)
end
+# not allowed:
+function plot!(subplt::Subplot, args...; kw...)
+ error("Can't call plot! on a Subplot!")
+end
+
function _add_series_subplot(plt::Plot, args...; kw...)
d = Dict(kw)
diff --git a/src/types.jl b/src/types.jl
index 493e049f..95529ad7 100644
--- a/src/types.jl
+++ b/src/types.jl
@@ -4,14 +4,14 @@ typealias AMat AbstractMatrix
immutable PlotsDisplay <: Display end
-abstract PlottingPackage
-abstract PlottingObject{T<:PlottingPackage}
+abstract AbstractBackend
+abstract AbstractPlot{T<:AbstractBackend}
# -----------------------------------------------------------
# Plot
# -----------------------------------------------------------
-type Plot{T<:PlottingPackage} <: PlottingObject{T}
+type Plot{T<:AbstractBackend} <: AbstractPlot{T}
o # the backend's plot object
backend::T # the backend type
n::Int # number of series
@@ -58,7 +58,7 @@ typealias IntOrFlex Union{Int,FlexLayout}
# Subplot
# -----------------------------------------------------------
-type Subplot{T<:PlottingPackage, L<:SubplotLayout} <: PlottingObject{T}
+type Subplot{T<:AbstractBackend, L<:SubplotLayout} <: AbstractPlot{T}
o # the underlying object
plts::Vector{Plot{T}} # the individual plots
backend::T
diff --git a/test/runtests.jl b/test/runtests.jl
index 3c582d6c..1ef7b04e 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -8,10 +8,10 @@ default(show=false)
img_eps = 5e-2
facts("Gadfly") do
- @fact gadfly() --> Plots.GadflyPackage()
- @fact backend() --> Plots.GadflyPackage()
+ @fact gadfly() --> Plots.GadflyBackend()
+ @fact backend() --> Plots.GadflyBackend()
- @fact typeof(plot(1:10)) --> Plots.Plot{Plots.GadflyPackage}
+ @fact typeof(plot(1:10)) --> Plots.Plot{Plots.GadflyBackend}
@fact plot(Int[1,2,3], rand(3)) --> not(nothing)
@fact plot(sort(rand(10)), rand(Int, 10, 3)) --> not(nothing)
@fact plot!(rand(10,3), rand(10,3)) --> not(nothing)
@@ -20,15 +20,15 @@ facts("Gadfly") do
end
facts("PyPlot") do
- @fact pyplot() --> Plots.PyPlotPackage()
- @fact backend() --> Plots.PyPlotPackage()
+ @fact pyplot() --> Plots.PyPlotBackend()
+ @fact backend() --> Plots.PyPlotBackend()
image_comparison_facts(:pyplot, skip=[4,10,13,19,21,23], eps=img_eps)
end
facts("GR") do
- @fact gr() --> Plots.GRPackage()
- @fact backend() --> Plots.GRPackage()
+ @fact gr() --> Plots.GRBackend()
+ @fact backend() --> Plots.GRBackend()
# image_comparison_facts(:gr, only=[1], eps=img_eps)
end