Tuesday, March 21, 2023

Map with Latitudes and Longitudes, filled with shades

Fun maps...


 

%%

clear all

 

% Sample latitude and longitude data

ilat = 25*rand(1,50)+25;

ilon = 50*rand(1,50)-120;

% Sample data for color-coding the points

data = 10*rand(1,50);

 

close all

latlim=[min(ilat) ,max(ilat)];

lonlim=[min(ilon) , max(ilon)];

% find number of stations lat lon and number of data

h1 = figure(1);

ax = worldmap(latlim, lonlim);

states = shaperead('usastatehi','UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);

geoshow(ax, states, 'Facecolor', [1 1 0.9]);

hold on

map = colormap;

colorvector = map(1:64,:);

pmvect = linspace(0, max(data), 64);

for jj = 1:length(data)

    %jj

colorb = interp1(pmvect, colorvector, data(jj));

plotm(ilat(jj),ilon(jj), data(jj),'o', 'MarkerEdgeColor','k','MarkerFaceColor', colorb, 'MarkerSize', 5);

hold on   

end

caxis([0  max(data)])

colorbar

hold off

set(gcf,'Color','white')

No comments: