how to colour two dimensional plane (not only the grid points) with four different colours from the use of co-ordinate points?

2 views (last 30 days)
I have to create a two dimensional colour plot using the co-ordinate points. The points are not in random order but they are not linear too. A region with the fixed x value and range of y value such as: (2.6, 0-3.6),(3, 0-3.1), (3.1, 0-3), (3.3, 0-2.7) need a colour and (2.6, 3.7-3.9),(3, 3.2-3.4), (3.1, 3.1-3.3), (3.3, 2.8-3) need another colour. Please help.
  2 Comments

Sign in to comment.

Accepted Answer

Monica Roberts
Monica Roberts on 9 Aug 2018
Can use "area", "fill", or "patch" functions (example below):
x1 = [2.6,3,3.1,3.3,3.3,3.1,3,2.6];
y1 = [0,0,0,0,2.7,3,3.1,3.6];
x2 = x1;
y2 = [3.7,3.2,3.1,2.8,3,3.3,3.4,3.9];
figure
patch(x1,y1,'cyan')
hold on
patch(x2,y2,'blue')

More Answers (0)

Community Treasure Hunt

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

Start Hunting!