How can I remove the subplot colorbar label overlaps?

 Accepted Answer

The easiest option is to use the 'FontSize' (link) name-value pair argument. (I cannot determine in what version that option first became available.)

4 Comments

@Star Strider, Thank you Star Strider. I only need 3 labels like the first two subplots

My pleasure.

Try something like this:

[X,Y,Z] = peaks;
figure
contourf(X,Y,Z)
c = colorbar;                                               % Return ‘colorbar’ Handle
tx = get(c, 'Ticks');                                       % Get Tick Label Values
txn = linspace(min(tx), max(tx), 3);                        % Calculate 3 New Tick Values
set(c, 'Ticks', txn)                                        % Set New Tick Labels
@Star Strider. Bravo!!! Thank you. Just what I needed. Many thanks and warm regards.
As always, my pleasure!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!