Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   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
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.