name changes; require to 0.4
This commit is contained in:
parent
58041cc64e
commit
391c7e8570
@ -7,7 +7,7 @@
|
|||||||
function createGadflyPlotObject(d::Dict)
|
function createGadflyPlotObject(d::Dict)
|
||||||
gplt = Gadfly.Plot()
|
gplt = Gadfly.Plot()
|
||||||
gplt.mapping = Dict()
|
gplt.mapping = Dict()
|
||||||
gplt.data_source = DataFrames.DataFrame()
|
gplt.data_source = Gadfly.DataFrames.DataFrame()
|
||||||
gplt.layers = gplt.layers[1:0]
|
gplt.layers = gplt.layers[1:0]
|
||||||
gplt.guides = Gadfly.GuideElement[Gadfly.Guide.xlabel(d[:xlabel]),
|
gplt.guides = Gadfly.GuideElement[Gadfly.Guide.xlabel(d[:xlabel]),
|
||||||
Gadfly.Guide.ylabel(d[:ylabel]),
|
Gadfly.Guide.ylabel(d[:ylabel]),
|
||||||
|
|||||||
@ -8,6 +8,8 @@ function createImmerseFigure(d::Dict)
|
|||||||
Immerse.Figure(figidx)
|
Immerse.Figure(figidx)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
# create a blank Gadfly.Plot object
|
# create a blank Gadfly.Plot object
|
||||||
function _create_plot(pkg::ImmersePackage; kw...)
|
function _create_plot(pkg::ImmersePackage; kw...)
|
||||||
|
|||||||
@ -156,7 +156,7 @@ makePyPlotCurrent(wrap::PyPlotAxisWrapper) = nothing #PyPlot.sca(wrap.ax.o)
|
|||||||
makePyPlotCurrent(plt::Plot{PyPlotPackage}) = makePyPlotCurrent(plt.o)
|
makePyPlotCurrent(plt::Plot{PyPlotPackage}) = makePyPlotCurrent(plt.o)
|
||||||
|
|
||||||
|
|
||||||
function preparePlotUpdate(plt::Plot{PyPlotPackage})
|
function _before_add_series(plt::Plot{PyPlotPackage})
|
||||||
makePyPlotCurrent(plt)
|
makePyPlotCurrent(plt)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ end
|
|||||||
# screen # Integer, move enclosing window to this screen number (for multiscreen desktops)
|
# 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)
|
# show # true or false, show the plot (in case you don't want the window to pop up right away)
|
||||||
|
|
||||||
function plot(pkg::PyPlotPackage; kw...)
|
function _create_plot(pkg::PyPlotPackage; kw...)
|
||||||
# create the figure
|
# create the figure
|
||||||
d = Dict(kw)
|
d = Dict(kw)
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ function plot(pkg::PyPlotPackage; kw...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function plot!(pkg::PyPlotPackage, plt::Plot; kw...)
|
function _add_series(pkg::PyPlotPackage, plt::Plot; kw...)
|
||||||
d = Dict(kw)
|
d = Dict(kw)
|
||||||
|
|
||||||
lt = d[:linetype]
|
lt = d[:linetype]
|
||||||
@ -545,7 +545,7 @@ function subplot(plts::AVec{Plot{PyPlotPackage}}, layout::SubplotLayout, d::Dict
|
|||||||
|
|
||||||
for (i,plt) in enumerate(plts)
|
for (i,plt) in enumerate(plts)
|
||||||
for seriesargs in plt.seriesargs
|
for seriesargs in plt.seriesargs
|
||||||
_plot_from_subplot!(newplts[i]; seriesargs...)
|
_add_series_subplot(newplts[i]; seriesargs...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ function adjustQwtKeywords(plt::Plot{QwtPackage}, iscreating::Bool; kw...)
|
|||||||
d
|
d
|
||||||
end
|
end
|
||||||
|
|
||||||
function plot(pkg::QwtPackage; kw...)
|
function _create_plot(pkg::QwtPackage; kw...)
|
||||||
d = Dict(kw)
|
d = Dict(kw)
|
||||||
fixcolors(d)
|
fixcolors(d)
|
||||||
dumpdict(d,"\n\n!!! plot")
|
dumpdict(d,"\n\n!!! plot")
|
||||||
@ -79,7 +79,7 @@ function plot(pkg::QwtPackage; kw...)
|
|||||||
plt
|
plt
|
||||||
end
|
end
|
||||||
|
|
||||||
function plot!(::QwtPackage, plt::Plot; kw...)
|
function _add_series(::QwtPackage, plt::Plot; kw...)
|
||||||
d = adjustQwtKeywords(plt, false; kw...)
|
d = adjustQwtKeywords(plt, false; kw...)
|
||||||
fixcolors(d)
|
fixcolors(d)
|
||||||
dumpdict(d,"\n\n!!! plot!")
|
dumpdict(d,"\n\n!!! plot!")
|
||||||
@ -270,10 +270,6 @@ function Base.display(::PlotsDisplay, subplt::Subplot{QwtPackage})
|
|||||||
for plt in subplt.plts
|
for plt in subplt.plts
|
||||||
Qwt.refresh(plt.o)
|
Qwt.refresh(plt.o)
|
||||||
end
|
end
|
||||||
# iargs = getinitargs(subplt,1)
|
|
||||||
# # iargs = subplt.initargs
|
|
||||||
# Qwt.resizewidget(subplt.o, iargs[:size]...)
|
|
||||||
# Qwt.movewidget(subplt.o, iargs[:pos]...)
|
|
||||||
Qwt.showwidget(subplt.o)
|
Qwt.showwidget(subplt.o)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -112,7 +112,7 @@ end
|
|||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
|
|
||||||
function plot(pkg::UnicodePlotsPackage; kw...)
|
function _create_plot(pkg::UnicodePlotsPackage; kw...)
|
||||||
plt = Plot(nothing, pkg, 0, Dict(kw), Dict[])
|
plt = Plot(nothing, pkg, 0, Dict(kw), Dict[])
|
||||||
|
|
||||||
# do we want to give a new default size?
|
# do we want to give a new default size?
|
||||||
@ -123,7 +123,7 @@ function plot(pkg::UnicodePlotsPackage; kw...)
|
|||||||
plt
|
plt
|
||||||
end
|
end
|
||||||
|
|
||||||
function plot!(::UnicodePlotsPackage, plt::Plot; kw...)
|
function _add_series(::UnicodePlotsPackage, plt::Plot; kw...)
|
||||||
d = Dict(kw)
|
d = Dict(kw)
|
||||||
if d[:linetype] in (:sticks, :bar)
|
if d[:linetype] in (:sticks, :bar)
|
||||||
d = barHack(; d...)
|
d = barHack(; d...)
|
||||||
|
|||||||
@ -25,14 +25,14 @@
|
|||||||
:star5 => "asterisk"
|
:star5 => "asterisk"
|
||||||
)
|
)
|
||||||
|
|
||||||
function preparePlotUpdate(plt::Plot{WinstonPackage})
|
function _before_add_series(plt::Plot{WinstonPackage})
|
||||||
Winston.ghf(plt.o)
|
Winston.ghf(plt.o)
|
||||||
end
|
end
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
function plot(pkg::WinstonPackage; kw...)
|
function _create_plot(pkg::WinstonPackage; kw...)
|
||||||
d = Dict(kw)
|
d = Dict(kw)
|
||||||
wplt = Winston.FramedPlot(title = d[:title], xlabel = d[:xlabel], ylabel = d[:ylabel])
|
wplt = Winston.FramedPlot(title = d[:title], xlabel = d[:xlabel], ylabel = d[:ylabel])
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ function getWinstonItems(plt::Plot)
|
|||||||
window, canvas, wplt
|
window, canvas, wplt
|
||||||
end
|
end
|
||||||
|
|
||||||
function plot!(::WinstonPackage, plt::Plot; kw...)
|
function _add_series(::WinstonPackage, plt::Plot; kw...)
|
||||||
d = Dict(kw)
|
d = Dict(kw)
|
||||||
|
|
||||||
window, canvas, wplt = getWinstonItems(plt)
|
window, canvas, wplt = getWinstonItems(plt)
|
||||||
|
|||||||
@ -50,7 +50,7 @@ function plot(args...; kw...)
|
|||||||
|
|
||||||
plotargs = getPlotArgs(pkg, d, 1)
|
plotargs = getPlotArgs(pkg, d, 1)
|
||||||
dumpdict(plotargs, "Plot args")
|
dumpdict(plotargs, "Plot args")
|
||||||
plt = plot(pkg; plotargs...) # create a new, blank plot
|
plt = _create_plot(pkg; plotargs...) # create a new, blank plot
|
||||||
|
|
||||||
delete!(d, :background_color)
|
delete!(d, :background_color)
|
||||||
plot!(plt, args...; d...) # add to it
|
plot!(plt, args...; d...) # add to it
|
||||||
@ -87,7 +87,7 @@ function plot!(plt::Plot, args...; kw...)
|
|||||||
groupargs = get(d, :group, nothing) == nothing ? [] : [extractGroupArgs(d[:group], args...)]
|
groupargs = get(d, :group, nothing) == nothing ? [] : [extractGroupArgs(d[:group], args...)]
|
||||||
|
|
||||||
# just in case the backend needs to set up the plot (make it current or something)
|
# just in case the backend needs to set up the plot (make it current or something)
|
||||||
preparePlotUpdate(plt)
|
_before_add_series(plt)
|
||||||
|
|
||||||
# get the list of dictionaries, one per series
|
# get the list of dictionaries, one per series
|
||||||
seriesArgList, xmeta, ymeta = createKWargsList(plt, groupargs..., args...; d...)
|
seriesArgList, xmeta, ymeta = createKWargsList(plt, groupargs..., args...; d...)
|
||||||
@ -111,7 +111,7 @@ function plot!(plt::Plot, args...; kw...)
|
|||||||
|
|
||||||
dumpdict(di, "Series $i")
|
dumpdict(di, "Series $i")
|
||||||
|
|
||||||
plot!(plt.backend, plt; di...)
|
_add_series(plt.backend, plt; di...)
|
||||||
end
|
end
|
||||||
|
|
||||||
_add_annotations(plt, d)
|
_add_annotations(plt, d)
|
||||||
@ -163,7 +163,7 @@ end
|
|||||||
|
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
preparePlotUpdate(plt::Plot) = nothing
|
_before_add_series(plt::Plot) = nothing
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -151,8 +151,8 @@ function backend()
|
|||||||
|
|
||||||
elseif currentBackendSymbol == :gadfly
|
elseif currentBackendSymbol == :gadfly
|
||||||
try
|
try
|
||||||
@eval import Gadfly, Compose, DataFrames
|
@eval import Gadfly, Compose
|
||||||
@eval export Gadfly, Compose, DataFrames
|
@eval export Gadfly, Compose
|
||||||
@eval include(joinpath(Pkg.dir("Plots"), "src", "backends", "gadfly_shapes.jl"))
|
@eval include(joinpath(Pkg.dir("Plots"), "src", "backends", "gadfly_shapes.jl"))
|
||||||
catch err
|
catch err
|
||||||
warn("Couldn't import Gadfly. Install it with: Pkg.add(\"Gadfly\").")
|
warn("Couldn't import Gadfly. Install it with: Pkg.add(\"Gadfly\").")
|
||||||
|
|||||||
@ -82,7 +82,7 @@ Base.getindex(subplt::Subplot, args...) = subplt.plts[subplt.layout[args...]]
|
|||||||
|
|
||||||
# handle "linking" the subplot axes together
|
# handle "linking" the subplot axes together
|
||||||
# each backend should implement the _remove_axis and _expand_limits methods
|
# each backend should implement the _remove_axis and _expand_limits methods
|
||||||
function linkAxis(subplt::Subplot, isx::Bool)
|
function link_axis(subplt::Subplot, isx::Bool)
|
||||||
|
|
||||||
# collect the list of plots and the expanded limits for those plots that should be linked on this axis
|
# collect the list of plots and the expanded limits for those plots that should be linked on this axis
|
||||||
includedPlots = Any[]
|
includedPlots = Any[]
|
||||||
@ -175,7 +175,7 @@ function subplot(args...; kw...)
|
|||||||
di = getPlotArgs(pkg, d, i)
|
di = getPlotArgs(pkg, d, i)
|
||||||
di[:subplot] = true
|
di[:subplot] = true
|
||||||
dumpdict(di, "Plot args (subplot $i)")
|
dumpdict(di, "Plot args (subplot $i)")
|
||||||
push!(plts, plot(pkg; di...))
|
push!(plts, _create_plot(pkg; di...))
|
||||||
end
|
end
|
||||||
|
|
||||||
# create the object and do the plotting
|
# create the object and do the plotting
|
||||||
@ -264,8 +264,8 @@ function _postprocess_subplot(subplt::Subplot, d::Dict)
|
|||||||
_update_plot_pos_size(subplt, d)
|
_update_plot_pos_size(subplt, d)
|
||||||
|
|
||||||
# handle links
|
# handle links
|
||||||
subplt.linkx && linkAxis(subplt, true)
|
subplt.linkx && link_axis(subplt, true)
|
||||||
subplt.linky && linkAxis(subplt, false)
|
subplt.linky && link_axis(subplt, false)
|
||||||
|
|
||||||
# set this to be current
|
# set this to be current
|
||||||
current(subplt)
|
current(subplt)
|
||||||
@ -335,7 +335,7 @@ function subplot!(subplt::Subplot, args...; kw...)
|
|||||||
dumpdict(di, "subplot! kwList $i")
|
dumpdict(di, "subplot! kwList $i")
|
||||||
dumpdict(plt.initargs, "plt.initargs before plotting")
|
dumpdict(plt.initargs, "plt.initargs before plotting")
|
||||||
|
|
||||||
_plot_from_subplot!(plt; di...)
|
_add_series_subplot(plt; di...)
|
||||||
end
|
end
|
||||||
|
|
||||||
_postprocess_subplot(subplt, d)
|
_postprocess_subplot(subplt, d)
|
||||||
@ -350,7 +350,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function _plot_from_subplot!(plt::Plot, args...; kw...)
|
function _add_series_subplot(plt::Plot, args...; kw...)
|
||||||
d = Dict(kw)
|
d = Dict(kw)
|
||||||
|
|
||||||
setTicksFromStringVector(d, d, :x, :xticks)
|
setTicksFromStringVector(d, d, :x, :xticks)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
julia 0.3
|
julia 0.4
|
||||||
|
|
||||||
Colors
|
Colors
|
||||||
Reexport
|
Reexport
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user