Fill pattern in a plot
20 views (last 30 days)
Show older comments
Hi,
I need to be able to fill pattern in each polygon. Right now, it is filling colours.
clear all;
clc;
A = [0.01 1.88
0.05 1.92
0.082 1.88
0.10 1.60
0.15 1.23
0.20 1.00
0.25 1.00
0.50 1.00
0.75 1.00
0.99 1.00 ] ;
pgon1 = polyshape([0.01 .082 .082 0.05 0.01],[1 1 1.88 1.92 1.881])
plot(pgon1)
hold on
pgon2 = polyshape([0.082 0.2 .15 .1 .082],[1 1 1.23 1.6 1.88])
plot(pgon2)
pgon3 = polyshape([0.2 .99 .99 .082 .082 .1 .15 .2],[1 1 2 2 1.88 1.6 1.23 1])
plot(pgon3)
pgon4 = polyshape([0.01 0.05 .082 .082 0.01],[1.88 1.92 1.88 2 2])
plot(pgon4)
xlim([0.01 .99]);
ylim([1 2]);
xticks([0.01 0.082 .25 .5 .75 .99])
xticklabels({'0.01','0.082','0.25','0.50','0.75','0.99'})
3 Comments
darova
on 6 Jun 2019
Easy enough: patch(x,y,'color',[0.5 0.1 0.2])
Use help
patch(A(:,1),A(:,2),'c')
Answers (0)
See Also
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!