@@ -23,7 +23,7 @@ function plot(f::Function, options=Dict())
2323end
2424
2525if Pkg. installed (" Polynomial" ) != = nothing
26- using Polynomial
26+ import Polynomial: Poly, polyval
2727
2828 function plot {T<:Number} (ps:: Array{Poly{T},1} , options= Dict ())
2929 data = [get_points (x-> polyval (p,x), merge ([" name" => " $p " ], options)) for p in ps]
@@ -33,4 +33,27 @@ if Pkg.installed("Polynomial") !== nothing
3333 function plot (p:: Poly , options= Dict ())
3434 return plot ([p], options)
3535 end
36+ end
37+
38+ if Pkg. installed (" TimeSeries" ) != = nothing
39+ import TimeSeries: TimeArray, timestamp, values, colnames
40+
41+ function plot (ts:: TimeArray , options= Dict ())
42+ data = [
43+ [" x" => map (t-> " $t " , timestamp (ts[col])), " y" => values (ts[col]), " type" => " scatter" , " mode" => " lines" , " name" => col]
44+ for col in colnames (ts)
45+ ]
46+ return plot ([data], options)
47+ end
48+ end
49+
50+ if Pkg. installed (" WAV" ) != = nothing
51+ function plot {T<:Number,U<:Number,V<:Number} (wav:: (Array{T,2},U,V,UnionType) , options= Dict ())
52+ opt = merge ([" layout" => [" xaxis" => [" title" => " seconds" ," dtick" => 1 ," tick0" => 0 ," autotick" => false ]]], options)
53+ w, Fs = wav
54+ X = [f/ Fs for f in 1.0 : length (w)]
55+ Y = [round (y,8 ) for y in w]
56+ data = [[" x" => X, " y" => Y, " type" => " scatter" , " mode" => " lines" , " name" => " WAV data" ]]
57+ return plot ([data], opt)
58+ end
3659end
0 commit comments