From 741aac8977f0b2cf6dfb36fc243c04d84af5b4a0 Mon Sep 17 00:00:00 2001 From: Julian P Samaroo Date: Thu, 31 Oct 2019 14:32:36 -0500 Subject: [PATCH] Fix plotting --- src/SpikingNeuralNetworks.jl | 5 ++--- src/plot.jl | 11 ++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/SpikingNeuralNetworks.jl b/src/SpikingNeuralNetworks.jl index a3af953..a5cd297 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 7b5876c..a65a5fd 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