Skip to content

Commit

Permalink
Add colorrange keyword with default to adjacency plot (#519)
Browse files Browse the repository at this point in the history
* add init value to `t_stops` reduce

* add `colorrange` kwarg with default to `adjacency`
  • Loading branch information
harisorgn authored Jan 6, 2025
1 parent 664860c commit 2cfd175
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions ext/MakieExtension.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import Neuroblox: powerspectrumplot, powerspectrumplot!

@recipe(Adjacency, blox_or_graph) do scene
Theme(
colormap = :grays
colormap = :grays,
colorrange = nothing
)
end

Expand All @@ -41,8 +42,14 @@ function Makie.plot!(p::Adjacency)
hideydecorations!(ax, ticklabels = false, ticks = false)

X, Y, D = findnz(adj.matrix)

colorrange = if isnothing(p.colorrange[])
(minimum(D), maximum(D))
else
p.colorrange[]
end

heatmap!(p, Y, X, D; colormap = p.colormap[])
heatmap!(p, Y, X, D; colormap = p.colormap[], colorrange)

return p
end
Expand Down
2 changes: 1 addition & 1 deletion src/blox/reinforcement_learning.jl
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function run_experiment!(agent::Agent, env::ClassificationEnvironment; verbose=f
agent.problem = remake(agent.problem; tspan, p=init_params)
end

t_stops = mapreduce(get_eval_times, union, values(learning_rules))
t_stops = mapreduce(get_eval_times, union, values(learning_rules); init=Float64[])

action_selection = agent.action_selection
if !isnothing(action_selection)
Expand Down

0 comments on commit 2cfd175

Please sign in to comment.