From 7b71d9a44860ddc6bbcc06c1ebc6fb4d0345992c Mon Sep 17 00:00:00 2001 From: Ritchie Lee Date: Sat, 2 Jan 2016 01:36:36 -0800 Subject: [PATCH 1/2] Small API change to animations Animation constructor minor fix --- src/animation.jl | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/animation.jl b/src/animation.jl index b923cf381..5122000f9 100644 --- a/src/animation.jl +++ b/src/animation.jl @@ -1,19 +1,18 @@ -immutable Animation{P<:PlottingObject} - plt::P +immutable Animation dir::ASCIIString frames::Vector{ASCIIString} end -function Animation(plt::PlottingObject) - Animation(plt, mktempdir(), ASCIIString[]) +function Animation() + tmpdir = convert(ASCIIString, mktempdir()) + Animation(tmpdir, ASCIIString[]) end -Animation() = Animation(current()) -function frame(anim::Animation) +function frame{P<:PlottingObject}(anim::Animation, plt::P=current()) i = length(anim.frames) + 1 filename = @sprintf("%06d.png", i) - png(anim.plt, joinpath(anim.dir, filename)) + png(plt, joinpath(anim.dir, filename)) push!(anim.frames, filename) end @@ -29,11 +28,11 @@ function gif(anim::Animation, fn::@compat(AbstractString) = "tmp.gif"; fps::Inte fn = abspath(fn) try - + # high quality speed = round(Int, 100 / fps) run(`convert -delay $speed -loop 0 $(anim.dir)/*.png $fn`) - + catch err warn("Tried to create gif using convert (ImageMagick), but got error: $err\nWill try ffmpeg, but it's lower quality...)") From 5c3c5b999f87438bd6f87590e33994f609467f81 Mon Sep 17 00:00:00 2001 From: Ritchie Lee Date: Sat, 2 Jan 2016 02:06:51 -0800 Subject: [PATCH 2/2] Support for SubDataFrame by switching to AbstractDataFrame --- src/plot.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plot.jl b/src/plot.jl index 5eaca4782..1408ff7e4 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -461,12 +461,12 @@ end function dataframes() @eval import DataFrames - @eval function createKWargsList(plt::PlottingObject, df::DataFrames.DataFrame, args...; kw...) + @eval function createKWargsList(plt::PlottingObject, df::DataFrames.AbstractDataFrame, args...; kw...) createKWargsList(plt, args...; kw..., dataframe = df) end # expecting the column name of a dataframe that was passed in... anything else should error - @eval function extractGroupArgs(s::Symbol, df::DataFrames.DataFrame, args...) + @eval function extractGroupArgs(s::Symbol, df::DataFrames.AbstractDataFrame, args...) if haskey(df, s) return extractGroupArgs(df[s]) else