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*(mmax1),0:DX:DX*(mmax1)); %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(n1,m1) ; x(n1,m) ; x(n,m) ; x(n,m1) ] ;% ii+1 since it has the BC Ypatch(1:4,cont) = [ y(n1,m1) ; y(n1,m) ; y(n,m) ; y(n,m1) ] ; Zpatch(cont) = 1; end end %hpatch3 = patch(Xpatch(:,:),Ypatch(:,:),Zpatch(:)'); % % display node indices % for m=1:mmax1 for n=1:nmax1 text(x(n,m),y(n,m),sprintf('(%d,%d)',mMAT(n,m),nMAT(n,m))); end end

