필터 지우기
필터 지우기

How do I plot a US state using the mapping toolbox?

조회 수: 6 (최근 30일)
Shane
Shane 2014년 7월 11일
댓글: Sourov Kumar Mondal 2024년 2월 27일
I need to plot California and then have to label points on the map based on latitude and longitude coordinates.
I got mapping toolbox for the first time and am confused about how to do this.
I checked the general help section and it didn't help much.
So I was able to plot California but still don't know how to plot points.

채택된 답변

Supreeth Subbaraya
Supreeth Subbaraya 2014년 8월 5일
To plot a US State and points on it, you could something as shown below:
%Read vector features and attributes from shapefile
cali = shaperead('usastatehi', 'UseGeoCoords', true,'Selector',{@(name) strcmpi(name,'California'), 'Name'});
axesm mercator; %Define Map axes
geoshow(cali); %Display map
plotm(lat,lon,'Color','r','Marker','.','MarkerSize',50); %plot point at [lat,lon] location
You have to assign appropriate values to the lat and lon variables. The above code plots the California state with a point at lat = 39 and lon = -123.6234. Similarly you can use the other plotting functions available here.
Some useful links,
  댓글 수: 2
Shane
Shane 2014년 8월 5일
thx
Sourov Kumar Mondal
Sourov Kumar Mondal 2024년 2월 27일
Hi, using this code how can I add the longitude and latitude on x and y axis in the map?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Map Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by