Plot a box around set of points

조회 수: 31 (최근 30일)
BN
BN 2020년 8월 4일
댓글: BN 2020년 8월 5일
Dear all, I would be grateful if you can tell me how I can create a 0.5 x 0.5 box around each point that I have. I want each point to be the center of the box, in fact.
Here is the list of my points which include latitude and longitude of them.
For example:
scatter(Points.lon, Points.lat, '.') % lon is x and lat is y

채택된 답변

KSSV
KSSV 2020년 8월 4일
This question can be solved from your previous question which was answered.
If (x,y) is your point and you want points around it as center.
% given point is (x,y) , make a bounding box around it
x = rand ; y = rand ;
% generate points for box
P = [x-0.5 y-0.5 ; x-0.5 y+0.5 ; x+0.5 y+0.5 ; x+0.5 y-0.5 ; x-0.5 y-0.5] ;
% plot
plot(x,y,'*r')
hold on
plot(P(:,1),P(:,2),'b')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by