animations
This commit is contained in:
parent
cd0dfc956d
commit
2c884ab5ab
@ -83,6 +83,10 @@ export
|
|||||||
supportedMarkers,
|
supportedMarkers,
|
||||||
subplotSupported,
|
subplotSupported,
|
||||||
|
|
||||||
|
Animation,
|
||||||
|
frame,
|
||||||
|
gif,
|
||||||
|
|
||||||
# recipes
|
# recipes
|
||||||
PlotRecipe,
|
PlotRecipe,
|
||||||
EllipseRecipe,
|
EllipseRecipe,
|
||||||
@ -105,6 +109,7 @@ include("args.jl")
|
|||||||
include("plot.jl")
|
include("plot.jl")
|
||||||
include("subplot.jl")
|
include("subplot.jl")
|
||||||
include("recipes.jl")
|
include("recipes.jl")
|
||||||
|
include("animation.jl")
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
|
|||||||
23
src/animation.jl
Normal file
23
src/animation.jl
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
immutable Animation{P<:PlottingObject}
|
||||||
|
plt::P
|
||||||
|
dir::ASCIIString
|
||||||
|
frames::Vector{ASCIIString}
|
||||||
|
end
|
||||||
|
|
||||||
|
function Animation(plt::PlottingObject)
|
||||||
|
Animation(plt, mktempdir(), ASCIIString[])
|
||||||
|
end
|
||||||
|
Animation() = Animation(current())
|
||||||
|
|
||||||
|
function frame(anim::Animation)
|
||||||
|
i = length(anim.frames) + 1
|
||||||
|
filename = @sprintf("%06d.png", i)
|
||||||
|
png(anim.plt, joinpath(anim.dir, filename))
|
||||||
|
push!(anim.frames, filename)
|
||||||
|
end
|
||||||
|
|
||||||
|
function gif(anim::Animation, fn::@compat(AbstractString) = tempname() * ".gif"; fps::Integer = 20)
|
||||||
|
run(`ffmpeg -framerate $fps -i $(anim.dir)/%06d.png -y $fn`)
|
||||||
|
info("Saved animation to ", fn)
|
||||||
|
end
|
||||||
@ -618,9 +618,9 @@ function getSeriesArgs(pkg::PlottingPackage, initargs::Dict, kw, commandIndex::I
|
|||||||
aliasesAndAutopick(d, :markershape, _markerAliases, supportedMarkers(pkg), plotIndex)
|
aliasesAndAutopick(d, :markershape, _markerAliases, supportedMarkers(pkg), plotIndex)
|
||||||
|
|
||||||
# update color
|
# update color
|
||||||
dumpdict(d, "before color")
|
# dumpdict(d, "before color")
|
||||||
d[:color] = getSeriesRGBColor(d[:color], initargs, plotIndex)
|
d[:color] = getSeriesRGBColor(d[:color], initargs, plotIndex)
|
||||||
dumpdict(d, "after color")
|
# dumpdict(d, "after color")
|
||||||
|
|
||||||
# update markercolor
|
# update markercolor
|
||||||
mc = d[:markercolor]
|
mc = d[:markercolor]
|
||||||
|
|||||||
@ -102,7 +102,7 @@ function plot!(plt::Plot, args...; kw...)
|
|||||||
preparePlotUpdate(plt)
|
preparePlotUpdate(plt)
|
||||||
|
|
||||||
# get the list of dictionaries, one per series
|
# get the list of dictionaries, one per series
|
||||||
dumpdict(d, "before createKWargsList")
|
# dumpdict(d, "before createKWargsList")
|
||||||
kwList, xmeta, ymeta = createKWargsList(plt, groupargs..., args...; d...)
|
kwList, xmeta, ymeta = createKWargsList(plt, groupargs..., args...; d...)
|
||||||
|
|
||||||
# if we were able to extract guide information from the series inputs, then update the plot
|
# if we were able to extract guide information from the series inputs, then update the plot
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user