"Konst " <konstance1@hotmail.com> wrote in message <icr5jb$e7v$1@fred.mathworks.com>...
> I have these commandsQ
> X=(a matrix)
> plot (X)
> i=1;
> while i>=1;
> [x,y] = ginput(2); % select two points on the curve
> get(gco,'Type');
> TF=strcmp(get(gco,'Type'),'line'); % TF=0 for a point outside the curve
> if TF==0
> saveas (gcf,'diagramma.fig');
> saveas (gcf,'diagramma.jpg');
> table1=[x1; x2; d;]
> table1=table1'
> break;
> end
> x1(i)=x(1);
> x2(i)=x(2);
> d(i)=x(2)x(1)
> axis manual
> rectangle('Position',[x(1),0,x(2)x(1),1],'Curvature',[0,0],'EdgeColor',[1,0,0])
> pause;
> i=i+1;
> end
> This draws the rectangle each time in front of the curve X so the lines of the curve that intersect with the rectangle are not visible. How can I do the opposite?That is, I need to put the rectangle behind the curve so that if I select the poin of their intersection I get the properties(line style, color etc) of the curve and not the rectangle...Any ideas?
My ide is as follows:
plot(1:10,'k','LineWidth',3)
[x y] = ginput(4);
hold on;
fill(x,y,'r')
ch = get(gca,'Children');
set(gca,'Children',ch(end:1:1))
Does that solve your problem?
