how to make a patch on geoplot?

I made a patch on plot.
i wanted to make a same patch on a geoplot. but it didn't work.
It would be good if you explain with 4 coordinates. do not mind 'z' value I will make a patch on 2d geoplot.
The coordinates is
x = [126.509 126.508 126.511 126.512]
y = [37.403 37.4063 37.4048 37.4081]
Thanks.

 Accepted Answer

You data is not in correct order. The axis scale is also not proportional. Try geoplot if you have mapping toolbox.
x = [126.509 126.508 126.511 126.512];
y = [37.403 37.4048 37.4081 37.4063]; % The original data order is incorrect
% geoplot
figure
geoplot(y([1:end 1]), x([1:end 1]))
geobasemap streets
% normal plot
figure
plot(x([1:end 1]), y([1:end 1]))
axis equal

2 Comments

How can i merge all rectangular if i make several rectangular on geoplot?
Just "hold on" and plot all rectangles.

Sign in to comment.

More Answers (1)

KSSV
KSSV on 28 Jun 2022
Edited: KSSV on 28 Jun 2022
x = [126.509 126.508 126.511 126.512] ;
y = [37.403 37.4063 37.4048 37.4081] ;
patch(x,y,'r')
In case, you looking for:
[val,idx] = sort(x) ;
patch(x(idx),y(idx),'r')

3 Comments

Sierra
Sierra on 28 Jun 2022
Edited: Sierra on 28 Jun 2022
Thanks. But what I want to know is how to make this patch on geoplot.
Won't hold on and patch work?
Patch does not work well on geoplot. Thanks

Sign in to comment.

Categories

Asked:

on 28 Jun 2022

Commented:

on 28 Jun 2022

Community Treasure Hunt

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

Start Hunting!