Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes proposed #106

Merged
merged 2 commits into from
Jan 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/animation.jl
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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...)")

Expand Down
4 changes: 2 additions & 2 deletions src/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down