diff --git a/src/animation.jl b/src/animation.jl index 55a9fe53..4afa01cf 100644 --- a/src/animation.jl +++ b/src/animation.jl @@ -1,4 +1,4 @@ - +"Represents an animation object" immutable Animation dir::String frames::Vector{String} @@ -9,6 +9,11 @@ function Animation() Animation(tmpdir, String[]) end +""" + frame(animation[, plot]) + +Add a plot (the current plot if not specified) to an existing animation +""" function frame{P<:AbstractPlot}(anim::Animation, plt::P=current()) i = length(anim.frames) + 1 filename = @sprintf("%06d.png", i) @@ -81,7 +86,7 @@ function buildanimation(animdir::AbstractString, fn::AbstractString; catch err warn("""Tried to create gif using convert (ImageMagick), but got error: $err ImageMagick can be installed by executing `Pkg.add("ImageMagick")`. - You may also need to install the imagemagick c++ library through your operating system. + You may also need to install the imagemagick c++ library through your operating system. Will try ffmpeg, but it's lower quality...)""") # low quality diff --git a/src/components.jl b/src/components.jl index 0ffe6226..eba135c2 100644 --- a/src/components.jl +++ b/src/components.jl @@ -39,6 +39,7 @@ vertices(shape::Shape) = collect(zip(shape.x, shape.y)) #deprecated @deprecate shape_coords coords +"return the vertex points from a Shape or Segments object" function coords(shape::Shape) shape.x, shape.y end @@ -163,6 +164,7 @@ Shape(k::Symbol) = deepcopy(_shapes[k]) # uses the centroid calculation from https://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon +"return the centroid of a Shape" function center(shape::Shape) x, y = coords(shape) n = length(x) @@ -196,6 +198,7 @@ function scale(shape::Shape, x::Real, y::Real = x, c = center(shape)) scale!(shapecopy, x, y, c) end +"translate a Shape in space" function translate!(shape::Shape, x::Real, y::Real = x) sx, sy = coords(shape) for i=1:length(sx) @@ -234,6 +237,7 @@ function rotate!(shape::Shape, Θ::Real, c = center(shape)) shape end +"rotate an object in space" function rotate(shape::Shape, Θ::Real, c = center(shape)) shapecopy = deepcopy(shape) rotate!(shapecopy, Θ, c) @@ -362,6 +366,11 @@ immutable Stroke style end +""" + stroke(args...; alpha = nothing) + +Define the properties of the stroke used in plotting lines +""" function stroke(args...; alpha = nothing) width = 1 color = :black @@ -609,6 +618,12 @@ immutable Arrow headwidth::Float64 end +""" + arrow(args...) + +Define arrowheads to apply to lines - args are `style` (`:open` or `:closed`), +`side` (`:head`, `:tail` or `:both`), `headlength` and `headwidth` +""" function arrow(args...) style = :simple side = :head @@ -664,7 +679,7 @@ immutable Formatted{T} end # ----------------------------------------------------------------------- - +"create a BezierCurve for plotting" type BezierCurve{T <: FixedSizeArrays.Vec} control_points::Vector{T} end diff --git a/src/examples.jl b/src/examples.jl index 87ae1ca4..8ae108ef 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -360,6 +360,13 @@ function test_examples(pkgname::Symbol, idx::Int; debug = false, disp = true) end # generate all plots and create a dict mapping idx --> plt +""" +test_examples(pkgname[, idx]; debug = false, disp = true, sleep = nothing, + skip = [], only = nothing + +Run the `idx` test example for a given backend, or all examples if `idx` +is not specified. +""" function test_examples(pkgname::Symbol; debug = false, disp = true, sleep = nothing, skip = [], only = nothing) Plots._debugMode.on = debug diff --git a/src/plotattr.jl b/src/plotattr.jl index cc8d053b..7313b2ce 100644 --- a/src/plotattr.jl +++ b/src/plotattr.jl @@ -14,6 +14,12 @@ function lookup_aliases(attrtype, attribute) error("There is no attribute named $attribute in $attrtype") end +""" + plotattr([attr]) + +Look up the properties of a Plots attribute, or specify an attribute type. Call `plotattr()` for options. +The information is the same as that given on https://juliaplots.github.io/attributes/. +""" function plotattr() println("Specify an attribute type to get a list of supported attributes. Options are $(attrtypes())") end diff --git a/src/recipes.jl b/src/recipes.jl index f5cb9b73..393bc2d4 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -847,6 +847,7 @@ end # TODO: move OHLC to PlotRecipes finance.jl +"Represent Open High Low Close data (used in finance)" type OHLC{T<:Real} open::T high::T diff --git a/src/utils.jl b/src/utils.jl index 6add802a..7e67f877 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -137,7 +137,7 @@ function imageHack(d::KW) end # --------------------------------------------------------------- - +"Build line segments for plotting" type Segments{T} pts::Vector{T} end @@ -185,6 +185,7 @@ type SegmentsIterator args::Tuple n::Int end + function iter_segments(args...) tup = Plots.wraptuple(args) n = maximum(map(length, tup))