Histogram Loop Color Issue

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

AR
AR 2022년 5월 5일
just found my error:
histogram(sendersSp(1,(sendersSp(k,:)<=800))...
should be written as
histogram(sendersSp(k,(sendersSp(k,:)<=800))

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Histograms에 대해 자세히 알아보기

질문:

AR
2022년 5월 5일

댓글:

AR
2022년 5월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by