Add colour to rectangle

Add colour to rectangle

Post by Abne » Thu, 23 Jul 2009 01:50:04


Hi,
I would like to know how do I add colour to a rectangle? I want to make the rect in Red..

Here is my code,

point = get(gcf,'CurrentPoint') ;
rect = [point(1,1) point(1,2) 30 12]; %Coordinates of the rectangle
[r2] = dragrect(rect);

Thanx!
 
 
 

Add colour to rectangle

Post by david.corr » Thu, 23 Jul 2009 02:12:36

Create a red octagon.

t = (1/16:1/8:1)'*2*pi;
x = sin(t);
y = cos(t);
fill(x,y,'r')
axis square




> > rect = [point(1,1) point(1,2) 30 12]; %Coordinates of the rectangle >>>> [r2] = dragrect(rect);> >> > > Thanx!> >> > use the "fill" function

 
 
 

Add colour to rectangle

Post by Abne » Fri, 24 Jul 2009 01:01:02

Hi, please forgive me I have misled you guys through the question. I dont want to fill the whole rectangle. What I intend to do is, just change the colour of the axes that make up the rectangle. Basically, I want to change the outline of the rectangle to red.
How do I do this?

Thank you.