Importing us map in MATLAB and specifying points based on their latitude and longitude using boardersm function

4 views (last 30 days)
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?

Accepted Answer

Yash
Yash on 21 Mar 2024
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');

More Answers (0)

Tags

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!