Skip to content

Commit 05ec8ee

Browse files
authored
Merge pull request #30 from UWB-Biocomputing/varndorfer/cn2025
STDP Histogram and Boxplot joint plot
2 parents 4221210 + f7282d7 commit 05ec8ee

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

STDP/plotStackedHistograms.m

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
% PLOTSTACKEDHISTOGRAMS Histogram and boxplot distribution of synaptic weights over time
2+
%
3+
% 1. Plot the histogram distribution of synaptic weights over time
4+
% 2. Plot the boxplot weight distribution at important times in the
5+
% simulation. The below code uses the distribution at the start (1
6+
% second), after the first burst (13 seconds), halfway through the
7+
% simulation (50 seconds), and at the end of the simulation.
8+
%
9+
% Syntax: plotStackedHistograms(weightEvolution)
10+
%
11+
% Input:
12+
% weightEvolution - csv file where x is the number of synapses
13+
% and y is number of seconds in the simulation.
14+
% Each row shows the synapse weight at y second.
15+
%
16+
% Author: Vanessa Arndorfer (vanessa.arndorfer@gmail.com)
17+
18+
function plotStackedHistograms(weightEvolution)
19+
20+
w = readmatrix(weightEvolution, 'Range', [2 1]);
21+
sim_len = size(w,2);
22+
23+
%% Plot
24+
num_bins = 25; % Number of bins in the histogram
25+
a = histogram(w(:,sim_len), num_bins);
26+
27+
times = [1,13,50,100];
28+
for i = 1:4
29+
figure('Position', [10 10 600 300]);
30+
clf()
31+
32+
s(1) = subplot(4,1,1:3);
33+
histogram(w(:,times(i)), num_bins);
34+
% yscale log
35+
ylabel('Total Synapses');
36+
xlim([-5.3813e-08, 5.0265e-07])
37+
38+
s(2) = subplot(4,1,4);
39+
boxplot(w(:,times(i)), 'Symbol','|b', 'Orientation', 'horizontal')
40+
xlabel('Synaptic Weight');
41+
linkaxes(s, 'x')
42+
end

0 commit comments

Comments
 (0)