diff --git a/src/SpikingNeuralNetworks.jl b/src/SpikingNeuralNetworks.jl index a3af9531141b74e92aee8273a51eb076a8848651..a5cd2975dce540af41836448319ad9a8116a246b 100644 --- a/src/SpikingNeuralNetworks.jl +++ b/src/SpikingNeuralNetworks.jl @@ -33,9 +33,8 @@ include("synapse/pinning_full_synapse.jl") include("synapse/fl_full_synapse.jl") # include("synapse/fl_synapse.jl") -@require Plots="91a5bcdd-55d7-5caf-9e0b-520d859cae80" begin - # FIXME: Also require StatsBase - include("plot.jl") +function __init__() + @require Plots="91a5bcdd-55d7-5caf-9e0b-520d859cae80" include("plot.jl") end end diff --git a/src/plot.jl b/src/plot.jl index 7b5876c05ac760bace300ed16c84fffeb0dc2181..a65a5fdebeaeabfc87178a1ee4f08812554f9a2a 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -1,10 +1,11 @@ -using StatsBase, Plots +using .Plots +# FIXME: using StatsBase function raster(p) fire = p.records[:fire] - x, y = SNNFloat[], SNNFloat[]; + x, y = SNNFloat[], SNNFloat[] for t = eachindex(fire) - for n in find(fire[t]) + for n in findall(fire[t]) push!(x, t) push!(y, n) end @@ -18,11 +19,11 @@ function raster(P::Array) for p in P x, y = raster(p) append!(X, x) - append!(Y, y + sum(y0)) + append!(Y, y .+ sum(y0)) push!(y0, p.N) end plt = scatter(X, Y, m = (1, :black), leg = :none, - xaxis=("t", (0, Inf)), yaxis = ("neuron",)) + xaxis=("t", (0, Inf)), yaxis = ("neuron",)) y0 = y0[2:end-1] !isempty(y0) && hline!(plt, cumsum(y0), linecolor = :red) return plt