Plotting negative values on an histogram
69 views (last 30 days)
Samuele Bolotta on 17 Apr 2021
I am plotting some values on an histogram.
histogram('Categories',Categories,'BinCounts',[-72 -63 -54 -56],'BarWidth',0.5,'FaceColor','#EDB120')
ylabel('Rest Memb Pot (mV)');
title('Amplitude of AP');
The problem is that whenever one of the values for BinCounts is negative, I get this error:
Error using histogram (line 156)
Expected input number 4, BinCounts, to be nonnegative.
While everything works perfectly if the values are all positive.
More Answers (1)
Bjorn Gustavsson on 17 Apr 2021
It seems likely that you've mixed up BinCounts and BinEdges - it doesn't make much sense to have a negative number of something in a bin (perhaps in economics if we're talking about debts?).