Plotting patchm or fillm on Geoplot or geoscatter

5 次查看(过去 30 天)
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!

回答(1 个)

Naga
Naga about 21 hours 前
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');

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by