function plot_indivHistDots(x, blim, nb, pParams, c, s)

% plot_indivHistDots(x, blim, nb, pParams, c, s)
%
% x       - vector of data, e.g., rand(100,1)
% blim    - bin limits, e.g., [0 1]
% nb      - number of bins, e.g., 10
% pParams - [x-center, dot spacing, dot size], e.g., [1 0.05 30]
% c       - color vector, e.g., [1 0 0]
% s       - side: -1 = leftwards; 1 - rightwards
%
% Description: The script plots individual data points in a histgram way.
% ------------------------------------------------------------------------
% B. Herrmann, Email: herrmann.b@gmail.com, 2019-11-23

% bin data
[Counts, Edges] = histcounts(x,'BinLimits',blim,'Normalization','count','NumBins',nb);

% get edge center
Ecent = mean([Edges(1:end-1); Edges(2:end)]);

% hold on figure for plotting
hold on;

% plot data
for ii = 1 : length(Ecent)
	scatter([1:Counts(ii)]*pParams(2)*s+pParams(1),ones([Counts(ii) 1])*Ecent(ii),pParams(3),'MarkerFaceColor',c,'MarkerEdgeColor','none')
end

