Plotting patchm or fillm on Geoplot or geoscatter
Afficher commentaires plus anciens
How can I plot a filled polygon using fillm or patchm on geoscatter?
I get:
Error using gcm (line 25)
Not a map axes.
Error in patchm (line 44)
mstruct = gcm;
Thanks!
Réponses (1)
Naga
le 26 Nov 2024
Hello Navad,
To plot a filled polygon on a map using `fillm` or `patchm`, you need to ensure that you are working with a map axes. The error you are encountering indicates that the current axes is not recognized as a map axes. Here is an example to plot a filled polygon using 'fillm' on a map axes:
% Create a figure
figure;
% Initialize map axes with a Mercator projection
ax = axesm('MapProjection', 'mercator', 'Frame', 'on', 'Grid', 'on');
% Set the map limits for latitude and longitude
setm(ax, 'MapLatLimit', [33 36], 'MapLonLimit', [-119 -116]);
% Define latitude and longitude for the polygon vertices
lat = [34, 34, 35, 35];
lon = [-118, -117, -117, -118];
% Plot the filled polygon on the map axes
fillm(lat, lon, 'r'); % 'r' specifies the color red
% Add title and labels
title('Filled Polygon using fillm on Map Axes');
xlabel('Longitude');
ylabel('Latitude');
Catégories
En savoir plus sur Vector and Raster Map Display dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!