R2014b bug with colorbar tick labels?

1 view (last 30 days)
Adam
Adam on 28 Nov 2014
Edited: Adam on 28 Nov 2014
Has anyone else had problems like the following (or know what may be wrong) with colorbars in R2014b?
I just changed some code that was working yesterday in R2014b, but now is suddenly producing a colormap with just a single tick label at the bottom. My code changes should have no bearing on this behaviour though - essentially all I did was embed the code into a different class than it was in yesterday.
The axes are embedded in a GUIDE figure, but they were yesterday when it worked too. If I put a breakpoint in the code and plot the exact same imagesc instruction to a new empty figure the colorbar behaves exactly as it should.
The colorbar object itself has the properties shown below, clearly showing that something is going wrong in the 'auto' tick generation. Again, when plotted in a new figure these ticks are correct (11 of them from 1 up to 3). The data in the image contains only three distinct values at 1, 2 and 3, but it always did and does still when plotted in the a new figure.
TickDirection: 'in'
TickLabelInterpreter: 'tex'
TickLabels: {'1'}
TickLabelsMode: 'auto'
TickLength: 0.01
Ticks: [-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1]
TicksMode: 'auto'

Accepted Answer

Adam
Adam on 28 Nov 2014
Edited: Adam on 28 Nov 2014
Ok, immediately after posting this I noticed something that turned out to be the problem.
My underlying data is now uint16 (yesterday it was double). I convert to single to plot so that was not a problem, but I calculate clims on the original data which means my clims are of type 'uint16'.
Thus when I added:
caxis( hAxes, clims )
which always used to be there, but used to be of type double, I get the above plot.
I'll leave the question up because it is, to me, slightly surprising behaviour that may catch others out too.
The moral of the story is not to use uint16 data type for the colourmap limits property even if your image data is just integers!

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!