I want to rescale a contourf plot when I zoom in and out

6 次查看(过去 30 天)
Ok, I will do my best to describe this. I have a matrix that I've plotted using a contour plot. The matrix is very feature rich, lots of peaks and troughs. However, The first and last few rows of the matrix are excessively large. Therefore most of the feature in the middle become hidden because the contours are so big to compensate.
I would like to attach some code to the zoom feature of the figure to rescale the contours after I have zoomed in/out on the figure, to only scale for what is currently being shown. This is how far I have got:
figure;
contourf(thisSec')
g = colorbar;
h = zoom;
h.ActionPostCallback = 'rescale(thisSec)';
Where my rescale function is currently:
function [] = rescale(myData)
Xlimits = round(get(gca,'XLim'));
Ylimits = round(get(gca,'YLim'));
thisData = myData(Xlimits(1):Xlimits(2),Ylimits(1):Ylimits(2));
maxData = max(max(thisData));
minData = min(min(thisData));
caxis([minData maxData]);
This does something to the colormap, but not exactly what I'm after. It doesn't show anymore features as I zoom in, but it does recolor things.
Can anyone help me with this please?
Thanks

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by