Skip to content

Commit

Permalink
Merge pull request #7 from jpsamaroo/jps/fix-plots
Browse files Browse the repository at this point in the history
[WIP] Fix plotting
  • Loading branch information
AStupidBear authored Nov 1, 2019
2 parents 1a7da0d + 741aac8 commit b342489
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/SpikingNeuralNetworks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 6 additions & 5 deletions src/plot.jl
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit b342489

Please sign in to comment.