MATLAB Answers

0

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

Asked by Jo Williams on 30 Mar 2015
Latest activity Edited by Jo Williams on 30 Mar 2015
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'))

  0 Comments

Sign in to comment.

0 Answers