Plotting patchm or fillm on Geoplot or geoscatter

6 visualizzazioni (ultimi 30 giorni)
Nadav Wetzler
Nadav Wetzler il 10 Mag 2019
Risposto: Naga il 26 Nov 2024 alle 5:10
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!

Risposte (1)

Naga
Naga il 26 Nov 2024 alle 5:10
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');

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by