Fill pattern in a plot
9 次查看(过去 30 天)
显示 更早的评论
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 个评论
darova
2019-6-6
Easy enough: patch(x,y,'color',[0.5 0.1 0.2])
Use help
patch(A(:,1),A(:,2),'c')
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Elementary Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!