moving plot or contour to a given point

moving plot or contour to a given point

Post by Tohi » Sun, 22 Mar 2009 03:52:02


Hia
I drew a contour or a plot. Now, I would like to move that contour or the plot to the given point 'M' in a figure. How can I do so?

for contour, as an example in 2d case, i would like to move it in a way that the upper right vertex coincide the point.

Cheers
Tohid
 
 
 

moving plot or contour to a given point

Post by us » Sun, 22 Mar 2009 04:21:01

"Tohid"

one of the solutions is outlined below
- it shows you how to move the contour patches
- it is left up to you to determine the shift-factor

sf=[1,1]; % <- x/y shift factor...
[ch,ch]=contour(peaks(256),[-4:.5:4]);
set(gca,'xlim',[0,512],'ylim',[0,512]);
cch=get(ch,'children');
xd=get(cch,'xdata');
yd=get(cch,'ydata');
for j=1:256
nxd=cellfun(@(x) x+j*sf(1),xd,'uni',false);
nyd=cellfun(@(x) x+j*sf(2),yd,'uni',false);
set(cch,{'xdata'},nxd,{'ydata'},nyd);
pause(.05);
end

us

 
 
 

moving plot or contour to a given point

Post by Tohi » Mon, 23 Mar 2009 23:49:02

Realy thanks us.
it was realy helpful.
can I have one mor question please?
if I want to shrink this contour you mentioned, what should I do?
I know in 2d case I can use the following matrix

[cos(t) sin(t); sin(t) cos(t)]; (where t is the degree of preference for shrinking)

to do the shrinking for a given vector but i dont know what to do for a plot or contour.
I will be glad if u can help me please
Tohid