How can I delete surface and contour data outside of the zoomed axes?

3 views (last 30 days)
I have an figure containing a number of very large surfaces (essentially a pcolor plot) overlaid with a contour plot of a different data set. Now I want to select a small area to reuse in another figure. I can copy it using copyobj(allchild(gca),newaxeshandle) and zoom using xlim([x1,x2]), ylim([y1,y2]), but that method carries along all the (many MB of) data outside the x,y limits I need. I'm not planning on zooming out again. How can I throw away the excess data?
Example:
%Draw a contour plot and check how big the data is:
contour(peaks),
ax1=gca;
ch=get(ax1,'children');
get(ch)
size(get(ch,'Contourmatrix')) %specifically
xlim([15,35]),ylim([35,45]);
%open a fresh axes as part of a new figure
figure
ax2=subplot(2,1,1);
copyobj(allchild(ax1),ax2);
ch=get(ax2,'children');
size(get(ch,'Contourmatrix'))

Answers (0)

Categories

Find more on Data Exploration in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!