added annotation options
This commit is contained in:
parent
c9388e9f56
commit
4f238caf5c
@ -131,6 +131,7 @@ immutable PlotText
|
|||||||
str::@compat(AbstractString)
|
str::@compat(AbstractString)
|
||||||
font::Font
|
font::Font
|
||||||
end
|
end
|
||||||
|
PlotText(str) = PlotText(string(str), font())
|
||||||
|
|
||||||
function text(str, args...)
|
function text(str, args...)
|
||||||
PlotText(string(str), font(args...))
|
PlotText(string(str), font(args...))
|
||||||
@ -268,7 +269,7 @@ end
|
|||||||
end
|
end
|
||||||
|
|
||||||
Base.mean(x::Real, y::Real) = 0.5*(x+y)
|
Base.mean(x::Real, y::Real) = 0.5*(x+y)
|
||||||
Base.mean{N,T<:Real}(p::FixedSizeArrays.Vec{N,T}, q::FixedSizeArrays.Vec{N,T}) = 0.5 * (p + q)
|
Base.mean{N,T<:Real}(ps::FixedSizeArrays.Vec{N,T}...) = sum(ps) / length(ps)
|
||||||
|
|
||||||
points(curve::BezierCurve, n::Integer = 50) = map(curve, linspace(0,1,n))
|
points(curve::BezierCurve, n::Integer = 50) = map(curve, linspace(0,1,n))
|
||||||
|
|
||||||
|
|||||||
@ -187,6 +187,7 @@ annotations(::@compat(Void)) = []
|
|||||||
annotations{X,Y,V}(v::AVec{@compat(Tuple{X,Y,V})}) = v
|
annotations{X,Y,V}(v::AVec{@compat(Tuple{X,Y,V})}) = v
|
||||||
annotations{X,Y,V}(t::@compat(Tuple{X,Y,V})) = [t]
|
annotations{X,Y,V}(t::@compat(Tuple{X,Y,V})) = [t]
|
||||||
annotations(v::AVec{PlotText}) = v
|
annotations(v::AVec{PlotText}) = v
|
||||||
|
annotations(v::AVec) = map(PlotText, v)
|
||||||
annotations(anns) = error("Expecting a tuple (or vector of tuples) for annotations: ",
|
annotations(anns) = error("Expecting a tuple (or vector of tuples) for annotations: ",
|
||||||
"(x, y, annotation)\n got: $(typeof(anns))")
|
"(x, y, annotation)\n got: $(typeof(anns))")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user