how do i plot data on a map of scotland? in matlab

To plot data on a map of Scotland in Matlab, you can use the geobubble or geoscatter functions from the Mapping toolbox. Here is an example code that demonstrates the plotting of data on a map of Scotland:

main.m
% Load the mapping data for Scotland
S = shaperead('gadm36_GBR_2.shp', 'UseGeoCoords', true);

% Extract the latitude and longitude coordinates of the map
latitude = [S.Lat];
longitude = [S.Lon];

% Create a scatter plot of the data on a map of Scotland
figure;
geoscatter(latitude, longitude, 'Marker', 'o', 'MarkerSize', 5);

% Add a title to the plot
title('Scotland Map with Data Points');
394 chars
14 lines

Note that the shaperead function reads a shapefile to obtain the map data for Scotland. The UseGeoCoords option is set to true to ensure that the data is properly geo-referenced.

The geoscatter function is used to create a scatter plot of the data on the map. The Marker and MarkerSize options are used to customize the appearance of the data points. You can adjust these options to suit your needs.

Finally, the title function is used to add a title to the plot. You can modify this function to add other elements to the plot, such as a legend, a colorbar or annotations.

related categories

gistlibby LogSnag