diff --git a/Project.toml b/Project.toml index 46efa41..202812d 100644 --- a/Project.toml +++ b/Project.toml @@ -7,6 +7,7 @@ version = "0.2.0" ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" StructC14N = "5369e15c-9fda-11e8-194c-95a38f2a9483" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" +StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" [extras] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/REQUIRE b/REQUIRE index 847e105..2a6cc1b 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,3 +1,4 @@ julia 0.7 StructC14N 0.2 ColorTypes 0.6.7 +StatsBase 0.25 diff --git a/src/Gnuplot.jl b/src/Gnuplot.jl index 2e5af49..744dc44 100644 --- a/src/Gnuplot.jl +++ b/src/Gnuplot.jl @@ -2,7 +2,7 @@ __precompile__(true) module Gnuplot -using StructC14N, ColorTypes, Printf +using StructC14N, ColorTypes, Printf, StatsBase import Base.reset import Base.quit @@ -1003,13 +1003,13 @@ gpeval(id::Symbol, s::String) = gpeval(id, [s]) #--------------------------------------------------------------------- -# function hist(v::Vector{T}; addright=false, closed::Symbol=:left, args...) where T <: AbstractFloat -# i = findall(isfinite.(v)) -# hh = fit(Histogram, v[i]; closed=closed, args...) -# if addright == 0 -# return PackedDataPlot([hh.edges[1], [hh.weights;0]], "", [], ["w steps"]) -# end -# return PackedDataPlot([hh.edges[1], [0;hh.weights]], "", [], ["w fsteps"]) -# end +function hist(v::Vector{T}; addright=false, closed::Symbol=:left, args...) where T <: AbstractFloat + i = findall(isfinite.(v)) + hh = fit(Histogram, v[i]; closed=closed, args...) + if addright == 0 + return PackedDataPlot([hh.edges[1], [hh.weights;0]], "", [], ["w steps"]) + end + return PackedDataPlot([hh.edges[1], [0;hh.weights]], "", [], ["w fsteps"]) +end end #module