Clear Filters
Clear Filters

display the maximum value of a dynamically updated colorbar

13 views (last 30 days)
Hi
I have a dynamically updated color bar, and I want the color bar always display its maximum value and minimum value no matter how they changes. How can I achieve it?
Thank you so much for your attention.

Accepted Answer

KSSV
KSSV on 16 Jul 2021
for i = 1:10
Z = peaks(100)*rand ;
pcolor(Z) ;
h = colorbar ;
val0 = min(Z(:)) ;
val1 = max(Z(:)) ;
h.Label.String = sprintf('min = %f, max = %f',val0,val1);
drawnow
end
  1 Comment
Katherinie Zheng
Katherinie Zheng on 16 Jul 2021
Thank you so much~~
Is there any way that I can change the orientation of the lable? Currently is wrting from bottom to up. I would like to read them from top to the bottom

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!