add the last docstrings

This commit is contained in:
Michael K. Borregaard 2017-08-16 11:21:44 +02:00
parent 66ce38d948
commit db82f22320
6 changed files with 39 additions and 4 deletions

View File

@ -1,4 +1,4 @@
"Represents an animation object"
immutable Animation immutable Animation
dir::String dir::String
frames::Vector{String} frames::Vector{String}
@ -9,6 +9,11 @@ function Animation()
Animation(tmpdir, String[]) Animation(tmpdir, String[])
end 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()) function frame{P<:AbstractPlot}(anim::Animation, plt::P=current())
i = length(anim.frames) + 1 i = length(anim.frames) + 1
filename = @sprintf("%06d.png", i) filename = @sprintf("%06d.png", i)

View File

@ -39,6 +39,7 @@ vertices(shape::Shape) = collect(zip(shape.x, shape.y))
#deprecated #deprecated
@deprecate shape_coords coords @deprecate shape_coords coords
"return the vertex points from a Shape or Segments object"
function coords(shape::Shape) function coords(shape::Shape)
shape.x, shape.y shape.x, shape.y
end 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 # uses the centroid calculation from https://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon
"return the centroid of a Shape"
function center(shape::Shape) function center(shape::Shape)
x, y = coords(shape) x, y = coords(shape)
n = length(x) n = length(x)
@ -196,6 +198,7 @@ function scale(shape::Shape, x::Real, y::Real = x, c = center(shape))
scale!(shapecopy, x, y, c) scale!(shapecopy, x, y, c)
end end
"translate a Shape in space"
function translate!(shape::Shape, x::Real, y::Real = x) function translate!(shape::Shape, x::Real, y::Real = x)
sx, sy = coords(shape) sx, sy = coords(shape)
for i=1:length(sx) for i=1:length(sx)
@ -234,6 +237,7 @@ function rotate!(shape::Shape, Θ::Real, c = center(shape))
shape shape
end end
"rotate an object in space"
function rotate(shape::Shape, Θ::Real, c = center(shape)) function rotate(shape::Shape, Θ::Real, c = center(shape))
shapecopy = deepcopy(shape) shapecopy = deepcopy(shape)
rotate!(shapecopy, Θ, c) rotate!(shapecopy, Θ, c)
@ -362,6 +366,11 @@ immutable Stroke
style style
end end
"""
stroke(args...; alpha = nothing)
Define the properties of the stroke used in plotting lines
"""
function stroke(args...; alpha = nothing) function stroke(args...; alpha = nothing)
width = 1 width = 1
color = :black color = :black
@ -609,6 +618,12 @@ immutable Arrow
headwidth::Float64 headwidth::Float64
end 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...) function arrow(args...)
style = :simple style = :simple
side = :head side = :head
@ -664,7 +679,7 @@ immutable Formatted{T}
end end
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
"create a BezierCurve for plotting"
type BezierCurve{T <: FixedSizeArrays.Vec} type BezierCurve{T <: FixedSizeArrays.Vec}
control_points::Vector{T} control_points::Vector{T}
end end

View File

@ -360,6 +360,13 @@ function test_examples(pkgname::Symbol, idx::Int; debug = false, disp = true)
end end
# generate all plots and create a dict mapping idx --> plt # 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, function test_examples(pkgname::Symbol; debug = false, disp = true, sleep = nothing,
skip = [], only = nothing) skip = [], only = nothing)
Plots._debugMode.on = debug Plots._debugMode.on = debug

View File

@ -14,6 +14,12 @@ function lookup_aliases(attrtype, attribute)
error("There is no attribute named $attribute in $attrtype") error("There is no attribute named $attribute in $attrtype")
end 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() function plotattr()
println("Specify an attribute type to get a list of supported attributes. Options are $(attrtypes())") println("Specify an attribute type to get a list of supported attributes. Options are $(attrtypes())")
end end

View File

@ -847,6 +847,7 @@ end
# TODO: move OHLC to PlotRecipes finance.jl # TODO: move OHLC to PlotRecipes finance.jl
"Represent Open High Low Close data (used in finance)"
type OHLC{T<:Real} type OHLC{T<:Real}
open::T open::T
high::T high::T

View File

@ -137,7 +137,7 @@ function imageHack(d::KW)
end end
# --------------------------------------------------------------- # ---------------------------------------------------------------
"Build line segments for plotting"
type Segments{T} type Segments{T}
pts::Vector{T} pts::Vector{T}
end end
@ -185,6 +185,7 @@ type SegmentsIterator
args::Tuple args::Tuple
n::Int n::Int
end end
function iter_segments(args...) function iter_segments(args...)
tup = Plots.wraptuple(args) tup = Plots.wraptuple(args)
n = maximum(map(length, tup)) n = maximum(map(length, tup))