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

1 view (last 30 days)
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

Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!