Which function to use for plotting a polygon with 4 coordinates ?

13 views (last 30 days)
I have a list of sets of 4 coordinates..(x1, y1)(x2, y2)(x3, y3)(x4, y4) and an intensity value associated with a set of four coordinates.
I need to plot a figure connecting these four points and as many figures as there are sets in the list in one Plot. Also, I need to color each polygon with a color specified by a number(intensity value).
How can it be achieved ?

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 16 Mar 2013
Edited: Azzi Abdelmalek on 16 Mar 2013
x=[x1 x2 x3 x4]
y=[y1 y2 y3 y4 ]
fill(x,y,'r')
Example
x=[0 2 3 2.5 1 0];
y=[0 0 1 2 2 0]
plot(x,y) % to plot polygon
fill(x,y,'g') % to fill the polygon
  4 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Elementary Polygons in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!