Histogram Loop Color Issue

1 view (last 30 days)
AR
AR on 5 May 2022
Commented: AR on 5 May 2022
Help with keeping my two colors on each histogram.
Each of k-histograms below have two two different colors plotted, orange for neurons=<800 and blue>800. For some reason, on the second k-loop, the colors for both plots default to just blue. I've attached my data, 5x2036 double. Each row in attached matrix, produces each k-histogram in code below.
figure(103) % NEURON POPULTATION SPIKE COUNTS, DURING LAST 2000 ms
nBinsN=(800-1)+1; % number of neuron bins
for k=1:size(sendersSp,1)
subplot(1,size(sendersSp,1),k)
histogram(sendersSp(1,(sendersSp(k,:)<=800)),nBinsN,'FaceColor',[0.9290 0.6940 0.1250],'EdgeColor',[0.9290 0.6940 0.1250],'EdgeAlpha',0.3,'BinMethod','integers')
ylabel('spike count');
xlabel('neuron #');
title(['Pttrn ',num2str(k),' Spikes']);
hold on
histogram(sendersSp(1,(sendersSp(k,:)>800)),nBinsN,'FaceColor',[0 0.4470 0.7410],'EdgeColor',[0 0.4470 0.7410],'EdgeAlpha',0.3,'BinMethod','integers')
hold off
end
Appreciate any suggestions to maintain two colors on each k-histogram. Thank you.
  1 Comment
AR
AR on 5 May 2022
just found my error:
histogram(sendersSp(1,(sendersSp(k,:)<=800))...
should be written as
histogram(sendersSp(k,(sendersSp(k,:)<=800))

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!