Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Figure with multiple displayed texts VERY slow to zoom and pan
Replies: 1   Last Post: Apr 7, 2013 1:29 PM

 Messages: [ Previous | Next ]
 AlbertoVe Posts: 33 From: Venice Registered: 3/14/08
Figure with multiple displayed texts VERY slow to zoom and pan
Posted: Feb 8, 2013 12:32 PM

Dear all,
I am dealing with a structured grid. I just wanna add to the plot a text of the type (m,n) that indicates the indices of each node. I use the text function. Once the plot is created it is very stuck a few seconds every time I pan and zoom. See on the follow a minimal example. I also added the patch that I use to display the grid. I use patch because I want to plot some grid quantities for each cell and I want to keep it general in case I move to an unstructured mesh with irregular polygons. Anyways even excluding patches it is still super slow.Any clue?

figure
%define grid and grid numbering
DX = 10 ; %=DY
mmax = 101; %= number of nodes in x
nmax = mmax %= number of nodes in y
[ x y ] = meshgrid(0:DX:DX*(mmax-1),0:DX:DX*(mmax-1)); %grid
[ mMAT nMAT ] = meshgrid(1:mmax,1:nmax); %grid numbering
%
%display patch
%
cont = 0
for m=2:mmax
for n=2:nmax
cont=cont+1;
Xpatch(1:4,cont) = [ x(n-1,m-1) ; x(n-1,m) ; x(n,m) ; x(n,m-1) ] ;% ii+1 since it has the BC
Ypatch(1:4,cont) = [ y(n-1,m-1) ; y(n-1,m) ; y(n,m) ; y(n,m-1) ] ;
Zpatch(cont) = 1;
end
end
%hpatch3 = patch(Xpatch(:,:),Ypatch(:,:),Zpatch(:)');
%
% display node indices
%
for m=1:mmax-1
for n=1:nmax-1
text(x(n,m),y(n,m),sprintf('(%d,%d)',mMAT(n,m),nMAT(n,m)));
end
end

Date Subject Author
2/8/13 AlbertoVe
4/7/13 AlbertoVe