Is default color bar min/max determined by displayed portion of the plot or all of it?

1 次查看(过去 30 天)
I use a color bar with 3-D data, so each point (X,Y) on the plot has a color determining its value. I changed the X axis min or max, decreasing the axis range, and saw that the color bar min/max did not change and the image color also remained the same.
This was surprising since the excluded region contained hot spot which were now removed from the plot.
Is there a way to refresh the color bar min/max (i.e. CLim values), after changing axes ranges so that it only refers to the portion of the plot being displayed?
Thanks, Neil

回答(1 个)

Sean de Wolski
Sean de Wolski 2012-8-7
You could use addlistener to add a listener to the axes' 'xlim' and 'ylim' properties. Then when they change the listener fires a callback to update the colorbar.
  2 个评论
Neil
Neil 2012-8-7
Thanks. It there a command to directly update the color bar, i.e. can the callback be invoked from within the matlab code? Then anytime I changed the axes min/max, I would call that.
Neil
Sean de Wolski
Sean de Wolski 2012-8-7
That's what the listener would do. It will sit in the background completely forgotten about and bored until the property its listening to changes ( 'PostSet' event). Then it will fire the callback.
The axes doesn't have a min and a max property so I am not sure what you mean by that.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by