Importing us map in MATLAB and specifying points based on their latitude and longitude using boardersm function
조회 수: 2 (최근 30일)
이전 댓글 표시
I want to import US map into MATLAB and specify various locations on the map by circular points. The color of points will be based on the expected solar irradiation on that location. I have been using bordersm function to draw us map in MATLAB. Anybody can help me?
채택된 답변
Yash
2024년 3월 21일
Hi Mohammad,
Here is a code snippet to mark specific locations on the US map based on their latitude and longitude values and color them based on solar irradiation values:
figure;
% Draw the continental US map with white face color
bordersm('continental us', 'FaceColor', 'w');
% Latitude & Longitude coordinates for New York, Los Angeles, and Chicago
lat = [40.7128, 34.0522, 41.8781];
lon = [-74.0060, -118.2437, -87.6298];
% Solar irradiation data for the three locations
solarIrradiation = [0.9; 0.5; 0.1];
% Plot circular points at the specified latitudes and longitudes
% The size of each point is 20, and the color is based on solar irradiation data
scatterm(lat, lon, 20, solarIrradiation, 'filled');
% Set the colormap to 'jet' which provides a spectrum of colors
colormap(jet);
% Add a colorbar to the figure to indicate the scale of solar irradiation
colorbar;
% Set the limits of the color scale to match the range of solar irradiation data
clim([min(solarIrradiation) max(solarIrradiation)]);
title('US Solar Irradiation Map');
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Map Display에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!