Error when using histogram2: array is wrong shape or size
Show older comments
Hello,
I have the following 1-by-9 vectors representing the bin edges of a bivariate histogram:
DIST_BINS = [0 5 10 20 30 50 100 200 1000];
MAG_BINS = [5.00 5.50 6.00 6.50 7.00 7.50 8.00 8.50 9.00];
I also have a 8-by-8 matrix with the bin counts:
DEAG_MATRIX = [ 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0;
0.0594 0.0485 0.0418 0.1706 0.0659 0.0039 0 0;
0 0 0 0 0 0 0 0;
0.0016 0.0029 0.0046 0.0250 0.0192 0.0067 0 0;
0 0 0.0000 0.0006 0.0006 0.0002 0 0;
0 0 0.0841 0.1712 0.1667 0.0109 0.0464 0.0683;
0 0 0 0.0001 0.0003 0.0000 0.0005 0.0000];
DEAG_MATRIX = round(DEAG_MATRIX*100)
When I try to use histogram2, I get the following error:
histogram2('XBinEdges',DIST_BINS,'YBinEdges',MAG_BINS,'BinCounts',DEAG_MATRIX)
Warning: Error creating or updating Quadrilateral
Error in value of property ColorData
Array is wrong shape or size
Warning: Error creating or updating Quadrilateral
Error in value of property ColorData
Array is wrong shape or size
Warning: Error creating or updating Quadrilateral
Error in value of property ColorData
Array is wrong shape or size
What am I doing wrong?
My version is MATLAB R2019b
3 Comments
Tommy
on 30 Apr 2020
Hmm, it works for me in 2019a. Does a plot show? It seems like you are just getting a warning.
Gustavo Araújo Rodríguez
on 30 Apr 2020
Tommy
on 30 Apr 2020
Oh awesome!
Answers (0)
Categories
Find more on Histograms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!