how to plot hexagon inside boundary?

I have boundary coordinates and I want to fill the patch with hexagons just like honeycomb.
Pleast let me know how to do this.
Thanks

 採用された回答

dpb
dpb 2022 年 8 月 11 日

1 投票

As a starting point...
N=6;
t=2*pi*(1/(2*N):1/N:1).';
x=cos(t);y=sin(t);
fill(x,y,'k')
axis square
hold on
hH=fill(x+2*max(x),y,'r');
axis square
ylim(xlim)
Those on the same row are obvious, the fillers in between need an adjustment of the x positon of only 1*x and of the height of the vertical side for y for the initial point -- then it's also tiled by 2X the X,Y position.
<fill> has a builtin replication routine that, I think, can be used to build the full array automagically, but I've not dug into just how to use it/how it works; there's not an example and didn't have time(*) to dig at the moment.
(*) Well, more like "inclination" would be more accurate... :)

2 件のコメント

Sierra
Sierra 2022 年 8 月 16 日
I want to plot hexagonal grid in geoplot. but i don't know how to do.
I attached the coordinates data and the image what i expect to plot.
Please Let me know.
Thanks.
dpb
dpb 2022 年 8 月 16 日
I don't have the mapping toolbox to even try, sorry...all I know is what I showed before of how to generate the coordinates of a hexagon and offset set them one to another to tile them...

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGraphics についてさらに検索

タグ

質問済み:

2022 年 8 月 10 日

コメント済み:

dpb
2022 年 8 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by