dsbisht
dsbisht

Reputation: 1035

How to display maximum value of colorbar in MATLAB plots as `>x`?

I am plotting a spatial plot, where I am displaying values from say 0 to 20 in colormap.

This is what I am doing,

caxis([0 20])    
h = colorbar('Fontsize', 4, 'LineWidth', 0.15);

Below is the generated colorbar,

enter image description here

Since, few values are larger than 20, I want to display the largest tick value in colorbar as >20 instead of 20.

How to do it?

Upvotes: 1

Views: 612

Answers (1)

EBH
EBH

Reputation: 10440

Just add this after your code:

h.TickLabels{end} = '>20';

or more generally:

h.TickLabels{end} = ['>' h.TickLabels{end}];

Upvotes: 5

Related Questions