This should be pretty simple I wager but I can't figure out anything on how to achieve it!
I just want my colorbar to display 1,000 instead of 1000.
Thanks!
This should be pretty simple I wager but I can't figure out anything on how to achieve it!
I just want my colorbar to display 1,000 instead of 1000.
Thanks!
You will need to modify the TickLabels
property. Below is a demostration:
figure; surf(peaks*1000);
l = colorbar;
ticks = l.Ticks;
nf = java.text.DecimalFormat;
for i = 1:numel(ticks)
l.TickLabels{i} = char(nf.format(ticks(i)));
end
See also How to print an integer with a thousands separator in Matlab?
The code following might help,
figure
surf(peaks*1000)
c=colorbar
c.TickLabels={'-6,000','-4,000','-,2,000','0','2,000','4,000','6,000','8,000'};
which has an output like this:
Besides, other useful properties of colorbar is documented here.